added security check to avoid errors on building empty flows
This commit is contained in:
parent
62b0b28b7f
commit
a41cc95abb
1 changed files with 3 additions and 0 deletions
|
|
@ -744,6 +744,9 @@ export function validateNode(n: NodeType, reactFlowInstance:ReactFlowInstance):A
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateNodes(reactFlowInstance:ReactFlowInstance){
|
export function validateNodes(reactFlowInstance:ReactFlowInstance){
|
||||||
|
if(reactFlowInstance.getNodes().length === 0){
|
||||||
|
return ["No nodes found in the flow. Please add at least one node to the flow."];
|
||||||
|
}
|
||||||
return reactFlowInstance
|
return reactFlowInstance
|
||||||
.getNodes()
|
.getNodes()
|
||||||
.flatMap((n: NodeType) => validateNode(n, reactFlowInstance));
|
.flatMap((n: NodeType) => validateNode(n, reactFlowInstance));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue