From 91f5542a57e04d6f6d417cd36e088f37cc6c1ce7 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 28 Apr 2021 20:54:31 +0100 Subject: [PATCH] Fix importing node to currently flow rather than match its old z value If you import a node whose z value is a known existing tab, it is getting imported to that tab, rather than the expected behaviour of being imported to the current tab. This commit fixes that by checked if the node is being imported to a tab that was included in the import, rather than pre-existing. --- .../node_modules/@node-red/editor-client/src/js/nodes.js | 6 ++++-- 1 file changed, 4 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 174892d43..9b580f9a0 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 @@ -1424,6 +1424,8 @@ RED.nodes = (function() { nid = getID(); workspace_map[n.id] = nid; n.id = nid; + } else { + workspace_map[n.id] = n.id; } addWorkspace(n); RED.workspaces.add(n); @@ -1523,7 +1525,7 @@ RED.nodes = (function() { } } } else { - if (n.z && !workspaces[n.z] && !subflow_map[n.z]) { + if (n.z && !workspace_map[n.z] && !subflow_map[n.z]) { n.z = activeWorkspace; } } @@ -1621,7 +1623,7 @@ RED.nodes = (function() { node.id = getID(); } else { node.id = n.id; - if (node.z == null || (!workspaces[node.z] && !subflow_map[node.z])) { + if (node.z == null || (!workspace_map[node.z] && !subflow_map[node.z])) { if (createMissingWorkspace) { if (missingWorkspace === null) { missingWorkspace = RED.workspaces.add(null,true);