From 9b1f86b68165c689c90924271647ca20f4daa01c Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Wed, 19 Apr 2023 14:20:05 -0300 Subject: [PATCH] refactor(chatComponent): simplify conditional statement in Chat component's error handling logic --- src/frontend/src/components/chatComponent/index.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 11516f004..1febb7539 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -93,7 +93,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { (errors: Array, t) => errors.concat( (template[t].required && template[t].show) && - (!template[t].value || template[t].value === "") && + (!template[t].value && template[t].value !== false && template[t].value === "") && !reactFlowInstance .getEdges() .some( @@ -102,12 +102,11 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { e.targetHandle.split("|")[2] === n.id ) ? [ - `${type} is missing ${ - template.display_name - ? template.display_name - : snakeToNormalCase(template[t].name) - }.`, - ] + `${type} is missing ${template.display_name + ? template.display_name + : snakeToNormalCase(template[t].name) + }.`, + ] : [] ), [] as string[]