From 1be3de50c5433789ec91e9f34d7501589b2eb7eb Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 29 Jun 2023 11:30:00 -0300 Subject: [PATCH] Changes to only make the Prompt Check run once --- src/frontend/src/components/promptComponent/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index 5cea7008c..3999d2786 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -29,16 +29,14 @@ export default function PromptAreaComponent({ }, [disabled, onChange]); useEffect(() => { - if (value !== "") { // only executed once + if (value !== "" && myValue !== value && reactFlowInstance) { // only executed once setMyValue(value); postValidatePrompt(value, nodeClass) .then((apiReturn) => { if (apiReturn.data) { setNodeClass(apiReturn.data.frontend_node); - if(reactFlowInstance){ - // need to update reactFlowInstance to re-render the nodes. - reactFlowInstance.setEdges(_.cloneDeep(reactFlowInstance.getEdges())); - } + // need to update reactFlowInstance to re-render the nodes. + reactFlowInstance.setEdges(_.cloneDeep(reactFlowInstance.getEdges())); } }) .catch((error) => {});