fix subflow calls

This commit is contained in:
Steve-Mcl 2022-02-25 18:39:48 +00:00
parent 29df7e84a1
commit e653a933f1
1 changed files with 7 additions and 3 deletions

View File

@ -44,12 +44,13 @@ module.exports = function(RED) {
* @returns {LinkTarget} a link target object * @returns {LinkTarget} a link target object
*/ */
function generateTarget(node) { function generateTarget(node) {
const isSubFlow = node._flow.TYPE === "subflow";
return { return {
id: node.id, id: node.id,
name: node.name || node.id, name: node.name || node.id,
flowId: node._flow.flow.id, flowId: node._flow.flow.id,
flowName: node._flow.flow.label, flowName: isSubFlow ? node._flow.subflowDef.name : node._flow.flow.label,
isSubFlow: false isSubFlow: isSubFlow
} }
} }
return { return {
@ -109,6 +110,9 @@ module.exports = function(RED) {
if(idx > -1) { if(idx > -1) {
targs.splice(idx,1); targs.splice(idx,1);
} }
if(targs.length === 0) {
delete registry.named[tn.name];
}
} }
delete registry.ids[target.id]; delete registry.ids[target.id];
}, },
@ -175,7 +179,7 @@ module.exports = function(RED) {
function LinkCallNode(n) { function LinkCallNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
const node = this; const node = this;
const staticTarget = n.links[0]; const staticTarget = typeof n.links === "string" ? n.links : n.links[0];
const linkType = n.linkType; const linkType = n.linkType;
const messageEvents = {}; const messageEvents = {};