mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47:29 -08:00
🐛 Fix issue with referencing values before loops
This commit is contained in:
parent
6bc3a20591
commit
7da86641d5
|
@ -635,6 +635,17 @@ export class Workflow {
|
|||
* @memberof Workflow
|
||||
*/
|
||||
getNodeConnectionOutputIndex(nodeName: string, parentNodeName: string, type = 'main', depth = -1, checkedNodes?: string[]): number | undefined {
|
||||
const node = this.getNode(parentNodeName);
|
||||
if (node === null) {
|
||||
return undefined;
|
||||
}
|
||||
const nodeType = this.nodeTypes.getByName(node.type) as INodeType;
|
||||
if (nodeType.description.outputs.length === 1) {
|
||||
// If the parent node has only one output, it can only be connected
|
||||
// to that one. So no further checking is required.
|
||||
return 0;
|
||||
}
|
||||
|
||||
depth = depth === -1 ? -1 : depth;
|
||||
const newDepth = depth === -1 ? depth : depth - 1;
|
||||
if (depth === 0) {
|
||||
|
@ -669,8 +680,8 @@ export class Workflow {
|
|||
}
|
||||
|
||||
if (checkedNodes!.includes(connection.node)) {
|
||||
// Node got checked already before
|
||||
return;
|
||||
// Node got checked already before so continue with the next one
|
||||
continue;
|
||||
}
|
||||
|
||||
outputIndex = this.getNodeConnectionOutputIndex(connection.node, parentNodeName, type, newDepth, checkedNodes);
|
||||
|
|
Loading…
Reference in a new issue