From 89f79d5dffbf37128c446b630c94397c19596df1 Mon Sep 17 00:00:00 2001 From: Jarek Danielak Date: Thu, 9 Jan 2025 14:12:06 +0100 Subject: [PATCH 1/2] fix(move-connection): null check new parent on revert Related to https://github.com/bpmn-io/bpmn-js/issues/2269 --- lib/features/modeling/cmd/MoveConnectionHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/features/modeling/cmd/MoveConnectionHandler.js b/lib/features/modeling/cmd/MoveConnectionHandler.js index de4d65323..967e43dde 100644 --- a/lib/features/modeling/cmd/MoveConnectionHandler.js +++ b/lib/features/modeling/cmd/MoveConnectionHandler.js @@ -58,7 +58,7 @@ MoveConnectionHandler.prototype.revert = function(context) { delta = context.delta; // remove from newParent - collectionRemove(newParent.children, connection); + newParent && collectionRemove(newParent.children, connection); // restore previous location in old parent collectionAdd(oldParent.children, connection, oldParentIndex); From 7465a5e1e9ca891d0f018b4416bf25a15266729c Mon Sep 17 00:00:00 2001 From: Jarek Danielak Date: Thu, 9 Jan 2025 14:12:52 +0100 Subject: [PATCH 2/2] fix(core/GrahicsFactory): account for removed shapes on updateContainments Related to https://github.com/bpmn-io/bpmn-js/issues/2269 --- lib/core/GraphicsFactory.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/core/GraphicsFactory.js b/lib/core/GraphicsFactory.js index 19e189078..9f2d3f6a6 100644 --- a/lib/core/GraphicsFactory.js +++ b/lib/core/GraphicsFactory.js @@ -192,6 +192,11 @@ GraphicsFactory.prototype.updateContainments = function(elements) { forEach(children.slice().reverse(), function(child) { var childGfx = elementRegistry.getGraphics(child); + // shape was removed + if (!childGfx) { + return; + } + prependTo(childGfx.parentNode, childrenGfx); }); });