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

This commit is contained in:
Jan Oberhauser 2023-01-23 05:47:07 -06:00 committed by GitHub
parent fcbf4fd587
commit 3ea83d872e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -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) => {

View file

@ -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;