Skip to content

Commit d018eb5

Browse files
authored
Merge pull request #2 from node-red/link-call-support
Handle link call nodes when creating flow model
2 parents dd9bede + ccf8803 commit d018eb5

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

lib/NRFlowSet.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class NRFlowSet {
5353
// config.{id,type} are removed in NRNode constructor
5454
const node = new NRNode(config)
5555
this.nodes.set(node.id, node);
56-
if (node.type === "link in" || node.type === "link out") {
56+
if (node.type === "link call" || node.type === "link in" || node.type === "link out") {
5757
linkNodes.push(node);
5858
}
5959
}
@@ -88,12 +88,14 @@ class NRFlowSet {
8888
if (!createdLinks.has(linkIdentifier)) {
8989
createdLinks.add(linkIdentifier);
9090
let remoteNode = this.nodes.get(remoteId);
91-
let sourceNode = linkNode.type === "link in"?remoteNode:linkNode;
92-
let destinationNode = linkNode.type === "link in"?linkNode:remoteNode;
93-
let wire = new NRWire(sourceNode, 0, destinationNode, 0, true);
94-
sourceNode.addOutboundWire(wire);
95-
destinationNode.addInboundWire(wire);
96-
this.wires.push(wire);
91+
if (remoteNode) {
92+
let sourceNode = linkNode.type === "link in"?remoteNode:linkNode;
93+
let destinationNode = linkNode.type === "link in"?linkNode:remoteNode;
94+
let wire = new NRWire(sourceNode, 0, destinationNode, 0, true);
95+
sourceNode.addOutboundWire(wire);
96+
destinationNode.addInboundWire(wire);
97+
this.wires.push(wire);
98+
}
9799
}
98100
})
99101
})

lib/NRNode.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ class NRNode extends NRObject {
155155
*/
156156
getNextNodes(followVirtual) {
157157
let result = [];
158-
this.outboundWires.forEach(wire => {
159-
if (!wire.virtual || followVirtual) {
160-
result.push(wire.destinationNode);
161-
}
162-
});
163-
return result;
158+
this.outboundWires.forEach(wire => {
159+
if (!wire.virtual || followVirtual) {
160+
result.push(wire.destinationNode);
161+
}
162+
});
163+
return result;
164164
}
165165

166166
/**

0 commit comments

Comments
 (0)