From 3b41e189d3e603dcc68ae14d9431cbfaa945e9bb Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Tue, 11 Jul 2023 23:04:36 -0300 Subject: [PATCH] Chat behavior fixed when there is no input variables empty --- src/frontend/src/modals/formModal/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index e80bc6c35..45c101f3f 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -50,7 +50,7 @@ export default function FormModal({ const handleKeys = formKeysData.handle_keys; const keyToUse = Object.keys(inputKeys).find( - (k) => !handleKeys.some((j) => j === k) + (k) => !handleKeys.some((j) => j === k) && inputKeys[k] === "" ); return inputKeys[keyToUse]; @@ -73,7 +73,9 @@ export default function FormModal({ const tabsStateFlowIdFormKeysData = tabsStateFlowId.formKeysData; const [chatKey, setChatKey] = useState( Object.keys(tabsState[flow.id].formKeysData.input_keys).find( - (k) => !tabsState[flow.id].formKeysData.handle_keys.some((j) => j === k) + (k) => + !tabsState[flow.id].formKeysData.handle_keys.some((j) => j === k) && + tabsState[flow.id].formKeysData.input_keys[k] === "" ) ); @@ -381,6 +383,9 @@ export default function FormModal({ if (checked === true) { setChatKey(i); setChatValue(tabsState[flow.id].formKeysData.input_keys[i]); + } else { + setChatKey(null); + setChatValue(""); } } return (