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.
This commit is contained in:
anovazzi1 2023-08-07 18:35:14 -03:00
commit 7f31f7f519

View file

@ -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);