Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Fix execute-once incoming data handling #5211

Merged
merged 1 commit into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/workflow/src/Workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
15 changes: 9 additions & 6 deletions packages/workflow/src/WorkflowDataProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down