From 476016cbcc08840f0b444bd378b225734e4ec00e Mon Sep 17 00:00:00 2001 From: GogoVega <92022724+GogoVega@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:22:22 +0200 Subject: [PATCH] Fix `node_map` does not contain as key the new id of a copied node --- .../node_modules/@node-red/editor-client/src/js/nodes.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index 54c89157a..c9f78cb25 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -2406,8 +2406,9 @@ RED.nodes = (function() { // get added if (activeSubflow && /^link /.test(n.type) && n.links) { n.links = n.links.filter(function(id) { - const otherNode = node_map[id] || RED.nodes.node(id); - return (otherNode && otherNode.z === activeWorkspace) + const otherNodeInMap = Object.values(node_map).filter(function(n) { return n.id === id; }); + const otherNode = (otherNodeInMap.length ? otherNodeInMap[0] : null) || RED.nodes.node(id); + return (otherNode && otherNode.z === activeWorkspace); }); } }