From af218867eb018678cd037f74bc544ac64684d5e9 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Wed, 16 Aug 2023 17:49:03 -0300 Subject: [PATCH] fix(formModal): fix nullish coalescing operator usage to handle nullable properties in tabsStateFlowId.formKeysData --- src/frontend/src/modals/formModal/index.tsx | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 0a7d35cb5..acca662d3 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -70,10 +70,11 @@ export default function FormModal({ const tabsStateFlowIdFormKeysData = tabsStateFlowId.formKeysData; const [chatKey, setChatKey] = useState(() => { if (tabsState[flow.id]?.formKeysData?.input_keys) { - return Object.keys(tabsState[flow.id].formKeysData.input_keys).find( + return Object.keys(tabsState[flow.id].formKeysData.input_keys!).find( (key) => - !tabsState[flow.id].formKeysData.handle_keys.some((j) => j === key) && - tabsState[flow.id].formKeysData.input_keys[key] === "" + !tabsState[flow.id].formKeysData.handle_keys!.some( + (j) => j === key + ) && tabsState[flow.id].formKeysData.input_keys![key] === "" ); } // TODO: return a sensible default @@ -430,7 +431,7 @@ export default function FormModal({ {tabsState[id.current]?.formKeysData?.input_keys ? Object.keys( - tabsState[id.current].formKeysData.input_keys + tabsState[id.current].formKeysData.input_keys! ).map((key, index) => (
t === key )} /> @@ -465,7 +466,7 @@ export default function FormModal({ keyValue={key} >
- {tabsState[id.current].formKeysData.handle_keys.some( + {tabsState[id.current].formKeysData.handle_keys!.some( (t) => t === key ) && (
@@ -475,7 +476,9 @@ export default function FormModal({