Merge pull request #4467 from xyflow/chore/parent-warning
Chore/parent warning
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/system': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore(subflows): log warning instead of throwing an error when parent node cant be found
|
||||||
@@ -105,8 +105,12 @@ function updateChildPosition<NodeType extends NodeBase>(
|
|||||||
|
|
||||||
const parentId = node.parentId!;
|
const parentId = node.parentId!;
|
||||||
const parentNode = nodeLookup.get(parentId);
|
const parentNode = nodeLookup.get(parentId);
|
||||||
|
|
||||||
if (!parentNode) {
|
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
|
// update the parentLookup
|
||||||
|
|||||||
Reference in New Issue
Block a user