Merge pull request #4467 from xyflow/chore/parent-warning

Chore/parent warning
This commit is contained in:
Moritz Klack
2024-07-18 13:39:09 +02:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'@xyflow/system': patch
---
chore(subflows): log warning instead of throwing an error when parent node cant be found

View File

@@ -105,8 +105,12 @@ function updateChildPosition<NodeType extends NodeBase>(
const parentId = node.parentId!;
const parentNode = nodeLookup.get(parentId);
if (!parentNode) {
throw new Error(`Parent node ${parentId} not found`);
console.warn(
`Parent node ${parentId} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`
);
return;
}
// update the parentLookup