From 900177a935cf317ced2450119ee767e6d53253f4 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 20 Jan 2023 17:09:42 -0600 Subject: [PATCH] fix(core): Fix execute-once incoming data handling --- packages/workflow/src/Workflow.ts | 1 - packages/workflow/src/WorkflowDataProxy.ts | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/workflow/src/Workflow.ts b/packages/workflow/src/Workflow.ts index c2a90d6d98e28..375b56e339a6d 100644 --- a/packages/workflow/src/Workflow.ts +++ b/packages/workflow/src/Workflow.ts @@ -1211,7 +1211,6 @@ export class Workflow { if (node.executeOnce === true) { // If node should be executed only once so use only the first input item - connectionInputData = connectionInputData.slice(0, 1); const newInputData: ITaskDataConnections = {}; for (const inputName of Object.keys(inputData)) { newInputData[inputName] = inputData[inputName].map((input) => { diff --git a/packages/workflow/src/WorkflowDataProxy.ts b/packages/workflow/src/WorkflowDataProxy.ts index 3cc2c280a7275..d8a8eafe47275 100644 --- a/packages/workflow/src/WorkflowDataProxy.ts +++ b/packages/workflow/src/WorkflowDataProxy.ts @@ -358,12 +358,6 @@ export class WorkflowDataProxy { executionData = taskData.main[outputIndex] as INodeExecutionData[]; } else { // Short syntax got used to return data from active node - - // TODO: Here have to generate connection Input data for the current node by itself - // Data needed: - // #- the run-index - // - node which did send data (has to be the one from last recent execution) - // - later also the name of the input and its index (currently not needed as it is always "main" and index "0") executionData = that.connectionInputData; } @@ -1174,6 +1168,15 @@ export class WorkflowDataProxy { $items: (nodeName?: string, outputIndex?: number, runIndex?: number) => { if (nodeName === undefined) { nodeName = (that.prevNodeGetter() as { name: string }).name; + const node = this.workflow.nodes[nodeName]; + let result = that.connectionInputData; + if (node.executeOnce === true) { + result = result.slice(0, 1); + } + if (result.length) { + return result; + } + return []; } outputIndex = outputIndex || 0;