1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure complete node scope is remapped in subflows

Fixes #2514
This commit is contained in:
Nick O'Leary 2020-03-27 09:44:15 +00:00
parent 1018c0e8a5
commit 4304d44851
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -154,7 +154,7 @@ class Subflow extends Flow {
var ui = old ? old.ui : null; var ui = old ? old.ui : null;
env[e.name] = e; env[e.name] = e;
if (ui) { if (ui) {
env[e.name].ui = ui; env[e.name].ui = ui;
} }
}); });
} }
@ -466,7 +466,7 @@ function createNodeInSubflow(subflowInstanceId, def) {
* properties in the nodes object to reference the new node ids. * properties in the nodes object to reference the new node ids.
* This handles: * This handles:
* - node.wires, * - node.wires,
* - node.scope of Catch and Status nodes, * - node.scope of Complete, Catch and Status nodes,
* - node.XYZ for any property where XYZ is recognised as an old property * - node.XYZ for any property where XYZ is recognised as an old property
* @param {[type]} nodes [description] * @param {[type]} nodes [description]
* @param {[type]} nodeMap [description] * @param {[type]} nodeMap [description]
@ -489,7 +489,7 @@ function remapSubflowNodes(nodes,nodeMap) {
} }
} }
} }
if ((node.type === 'catch' || node.type === 'status') && node.scope) { if ((node.type === 'complete' || node.type === 'catch' || node.type === 'status') && node.scope) {
node.scope = node.scope.map(function(id) { node.scope = node.scope.map(function(id) {
return nodeMap[id]?nodeMap[id].id:"" return nodeMap[id]?nodeMap[id].id:""
}) })