From e653a933f1d5dd912f857b59fd34a81d23c07d2c Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Fri, 25 Feb 2022 18:39:48 +0000 Subject: [PATCH] fix subflow calls --- .../@node-red/nodes/core/common/60-link.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/nodes/core/common/60-link.js b/packages/node_modules/@node-red/nodes/core/common/60-link.js index 86a0ebc6c..2b0618d30 100644 --- a/packages/node_modules/@node-red/nodes/core/common/60-link.js +++ b/packages/node_modules/@node-red/nodes/core/common/60-link.js @@ -44,12 +44,13 @@ module.exports = function(RED) { * @returns {LinkTarget} a link target object */ function generateTarget(node) { + const isSubFlow = node._flow.TYPE === "subflow"; return { id: node.id, name: node.name || node.id, flowId: node._flow.flow.id, - flowName: node._flow.flow.label, - isSubFlow: false + flowName: isSubFlow ? node._flow.subflowDef.name : node._flow.flow.label, + isSubFlow: isSubFlow } } return { @@ -109,6 +110,9 @@ module.exports = function(RED) { if(idx > -1) { targs.splice(idx,1); } + if(targs.length === 0) { + delete registry.named[tn.name]; + } } delete registry.ids[target.id]; }, @@ -175,7 +179,7 @@ module.exports = function(RED) { function LinkCallNode(n) { RED.nodes.createNode(this,n); const node = this; - const staticTarget = n.links[0]; + const staticTarget = typeof n.links === "string" ? n.links : n.links[0]; const linkType = n.linkType; const messageEvents = {};