refactor(GenericNode): remove commented out code and add comments to code
feat(GenericNode): add validation check for node changes by comparing length of nodes and edges array
This commit is contained in:
parent
d52e7700c0
commit
e4b4cf19a2
1 changed files with 6 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ export default function GenericNode({
|
|||
|
||||
const debouncedValidateNode = useDebouncedCallback(async () => {
|
||||
// Check if the validationStatus is "success"
|
||||
if (validationStatus === "success") return;
|
||||
// if (validationStatus === "success") return;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/validate/node/${data.id}`, {
|
||||
|
|
@ -62,7 +62,11 @@ export default function GenericNode({
|
|||
validateNode();
|
||||
}, [
|
||||
validateNode,
|
||||
...Object.values(data.node.template).flatMap((t) => Object.values(t)),
|
||||
// Use the result of ...reactFlowInstance.toObject()
|
||||
// to determine if the node has changed
|
||||
// turn into an array of nodes and edges
|
||||
// and compare the length of the array
|
||||
...Object.values(reactFlowInstance.toObject()),
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue