mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57: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
|
* @memberof Workflow
|
||||||
*/
|
*/
|
||||||
getNodeConnectionOutputIndex(nodeName: string, parentNodeName: string, type = 'main', depth = -1, checkedNodes?: string[]): number | undefined {
|
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;
|
depth = depth === -1 ? -1 : depth;
|
||||||
const newDepth = depth === -1 ? depth : depth - 1;
|
const newDepth = depth === -1 ? depth : depth - 1;
|
||||||
if (depth === 0) {
|
if (depth === 0) {
|
||||||
|
@ -669,8 +680,8 @@ export class Workflow {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkedNodes!.includes(connection.node)) {
|
if (checkedNodes!.includes(connection.node)) {
|
||||||
// Node got checked already before
|
// Node got checked already before so continue with the next one
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputIndex = this.getNodeConnectionOutputIndex(connection.node, parentNodeName, type, newDepth, checkedNodes);
|
outputIndex = this.getNodeConnectionOutputIndex(connection.node, parentNodeName, type, newDepth, checkedNodes);
|
||||||
|
|
Loading…
Reference in a new issue