Changes to only make the Prompt Check run once
This commit is contained in:
parent
18b2226b12
commit
1be3de50c5
1 changed files with 3 additions and 5 deletions
|
|
@ -29,16 +29,14 @@ export default function PromptAreaComponent({
|
||||||
}, [disabled, onChange]);
|
}, [disabled, onChange]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (value !== "") { // only executed once
|
if (value !== "" && myValue !== value && reactFlowInstance) { // only executed once
|
||||||
setMyValue(value);
|
setMyValue(value);
|
||||||
postValidatePrompt(value, nodeClass)
|
postValidatePrompt(value, nodeClass)
|
||||||
.then((apiReturn) => {
|
.then((apiReturn) => {
|
||||||
if (apiReturn.data) {
|
if (apiReturn.data) {
|
||||||
setNodeClass(apiReturn.data.frontend_node);
|
setNodeClass(apiReturn.data.frontend_node);
|
||||||
if(reactFlowInstance){
|
// need to update reactFlowInstance to re-render the nodes.
|
||||||
// need to update reactFlowInstance to re-render the nodes.
|
reactFlowInstance.setEdges(_.cloneDeep(reactFlowInstance.getEdges()));
|
||||||
reactFlowInstance.setEdges(_.cloneDeep(reactFlowInstance.getEdges()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {});
|
.catch((error) => {});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue