From 02e55153e406b6a61904af6bff27dbae6151c3a2 Mon Sep 17 00:00:00 2001 From: moklick Date: Thu, 18 Jul 2024 13:35:45 +0200 Subject: [PATCH 1/3] chore(subflows): log warning instead of throwing an error #4455 --- packages/system/src/utils/store.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/system/src/utils/store.ts b/packages/system/src/utils/store.ts index 5a977cc0..3f08b0f7 100644 --- a/packages/system/src/utils/store.ts +++ b/packages/system/src/utils/store.ts @@ -104,8 +104,12 @@ function updateChildPosition( const parentId = node.parentId!; const parentNode = nodeLookup.get(parentId); + if (!parentNode) { - throw new Error(`Parent node ${parentId} not found`); + console.warn( + `[React Flow]: 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 From 423976b3c3d4433f73e181b7a9a6a063d4760750 Mon Sep 17 00:00:00 2001 From: moklick Date: Thu, 18 Jul 2024 13:37:40 +0200 Subject: [PATCH 2/3] chore(subflow): adjust warning --- packages/system/src/utils/store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/system/src/utils/store.ts b/packages/system/src/utils/store.ts index 3f08b0f7..da7dbc06 100644 --- a/packages/system/src/utils/store.ts +++ b/packages/system/src/utils/store.ts @@ -107,7 +107,7 @@ function updateChildPosition( if (!parentNode) { console.warn( - `[React Flow]: Parent node ${parentId} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.` + `Parent node ${parentId} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.` ); return; } From c253c7c59a2ccd2cb91ad44ce4acbe481d9d7fe1 Mon Sep 17 00:00:00 2001 From: moklick Date: Thu, 18 Jul 2024 13:38:28 +0200 Subject: [PATCH 3/3] chore(changeset): add --- .changeset/tall-onions-guess.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tall-onions-guess.md diff --git a/.changeset/tall-onions-guess.md b/.changeset/tall-onions-guess.md new file mode 100644 index 00000000..451a5a6c --- /dev/null +++ b/.changeset/tall-onions-guess.md @@ -0,0 +1,5 @@ +--- +'@xyflow/system': patch +--- + +chore(subflows): log warning instead of throwing an error when parent node cant be found