From 7f31f7f519e4ac8ae1da5282a967bfe447cab89a Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 7 Aug 2023 18:35:14 -0300 Subject: [PATCH] refactor(chatComponent): simplify condition for setting canOpen state in Chat component The condition for setting the `canOpen` state in the Chat component was simplified by removing unnecessary checks for `formKeysData.input_keys` and `Object.keys(tabsState[flow.id].formKeysData.input_keys).length > 0`. The new condition only checks for the existence of `tabsState[flow.id].formKeysData`. This change improves code readability and reduces unnecessary complexity. --- src/frontend/src/components/chatComponent/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 3cbe5bbf1..ac551f6de 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -58,13 +58,7 @@ export default function Chat({ flow }: ChatType) { ) { setIsBuilt(false); } - if ( - tabsState && - tabsState[flow.id] && - tabsState[flow.id].formKeysData && - tabsState[flow.id].formKeysData.input_keys && - Object.keys(tabsState[flow.id].formKeysData.input_keys).length > 0 - ) { + if (tabsState && tabsState[flow.id] && tabsState[flow.id].formKeysData) { setCanOpen(true); } else { setCanOpen(false);