Undefined issues

This commit is contained in:
Elizabeth Cray 2023-07-23 20:38:50 -04:00
parent 454108a959
commit b2e042a36b

View File

@ -93,6 +93,7 @@ function App() {
}; };
const handleSubClick = (topic: string, index: number) => { const handleSubClick = (topic: string, index: number) => {
if (codes){
let text = getTopicChildren(topic)[index]; let text = getTopicChildren(topic)[index];
let filtered = codes.filter((code: Code) => code.type === topic && code.text === text); let filtered = codes.filter((code: Code) => code.type === topic && code.text === text);
if (filtered.length == 1) { if (filtered.length == 1) {
@ -100,6 +101,7 @@ function App() {
setSubTopic(""); setSubTopic("");
invoke('type_str', {input: payload}); invoke('type_str', {input: payload});
} }
}
}; };
const SubMenu = () => { const SubMenu = () => {
@ -132,6 +134,7 @@ function App() {
} }
const handleTopicClick = (type: string) => { const handleTopicClick = (type: string) => {
if (codes) {
let filtered = codes.filter((code: Code) => code.type === type); let filtered = codes.filter((code: Code) => code.type === type);
if (filtered.length == 1) { if (filtered.length == 1) {
let assembledStr: string = generatePayload(filtered[0]); let assembledStr: string = generatePayload(filtered[0]);
@ -141,6 +144,7 @@ function App() {
// Open Submenu for type // Open Submenu for type
setSubTopic(type); setSubTopic(type);
} }
}
}; };
const buildMenu = () => { const buildMenu = () => {
@ -167,7 +171,6 @@ function App() {
})} })}
</div> </div>
); );
// TODO: This isn't returning as expected, use an object to append to then return the compiled list
}else{ }else{
return (<div></div>); return (<div></div>);
} }