refactor(core): Move single node check outside of the nodes loop (#16959)

This commit is contained in:
Ioannis Canellos
2025-07-11 16:32:26 +03:00
committed by GitHub
parent a34b30acc7
commit f928c58042
2 changed files with 25 additions and 3 deletions

View File

@@ -900,13 +900,16 @@ export class Workflow {
// Check if there are any trigger or poll nodes and then return the first one
let node: INode;
let nodeType: INodeType;
for (const nodeName of nodeNames) {
node = this.nodes[nodeName];
if (nodeNames.length === 1 && !node.disabled) {
if (nodeNames.length === 1) {
node = this.nodes[nodeNames[0]];
if (node && !node.disabled) {
return node;
}
}
for (const nodeName of nodeNames) {
node = this.nodes[nodeName];
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
// TODO: Identify later differently