From 51c867fb668c3ed84dd75f5dec8f2b980bf7052c Mon Sep 17 00:00:00 2001 From: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com> Date: Wed, 20 Aug 2025 10:58:41 +0100 Subject: [PATCH] Revert "fix(core): Check all node outputs when using "Always Output Data" before adding an empty object" (#18577) --- .../always_output_data_multiple_outputs.json | 137 ------------------ .../__tests__/workflows/paired_items_fix.json | 38 +++-- .../src/execution-engine/workflow-execute.ts | 4 +- 3 files changed, 23 insertions(+), 156 deletions(-) delete mode 100644 packages/core/src/execution-engine/__tests__/workflows/always_output_data_multiple_outputs.json diff --git a/packages/core/src/execution-engine/__tests__/workflows/always_output_data_multiple_outputs.json b/packages/core/src/execution-engine/__tests__/workflows/always_output_data_multiple_outputs.json deleted file mode 100644 index c68c42aecf..0000000000 --- a/packages/core/src/execution-engine/__tests__/workflows/always_output_data_multiple_outputs.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "name": "Always Output Data Multiple Outputs", - "nodes": [ - { - "parameters": {}, - "type": "n8n-nodes-base.manualTrigger", - "typeVersion": 1, - "position": [0, 0], - "id": "b7c1c0d1-ff36-4899-8f95-4405bbbcfad0", - "name": "When clicking ‘Execute workflow’" - }, - { - "parameters": { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 2 - }, - "conditions": [ - { - "id": "8bc8b97d-2d13-4267-80e4-5947cb0c61db", - "leftValue": false, - "rightValue": "", - "operator": { - "type": "boolean", - "operation": "true", - "singleValue": true - } - } - ], - "combinator": "and" - }, - "options": {} - }, - "type": "n8n-nodes-base.if", - "typeVersion": 2.2, - "position": [448, 0], - "id": "8d02b70d-d24f-4f38-ad68-588ef3479d3e", - "name": "If", - "alwaysOutputData": true - }, - { - "parameters": { - "assignments": { - "assignments": [ - { - "id": "40ee7f65-691d-40e8-99cc-ccdc0632319e", - "name": "foo", - "value": "bar", - "type": "string" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.set", - "typeVersion": 3.4, - "position": [224, 0], - "id": "41e24bec-18b6-4d73-9737-98294117a41a", - "name": "Edit Fields" - }, - { - "parameters": {}, - "type": "n8n-nodes-base.noOp", - "typeVersion": 1, - "position": [704, 0], - "id": "1ce47245-adc0-4352-8435-ab6b563ce76f", - "name": "No Operation, do nothing" - } - ], - "pinData": { - "No Operation, do nothing": [ - { - "json": { - "foo": "bar" - }, - "pairedItem": { - "item": 0 - } - } - ] - }, - "connections": { - "When clicking ‘Execute workflow’": { - "main": [ - [ - { - "node": "Edit Fields", - "type": "main", - "index": 0 - } - ] - ] - }, - "Edit Fields": { - "main": [ - [ - { - "node": "If", - "type": "main", - "index": 0 - } - ] - ] - }, - "If": { - "main": [ - [ - { - "node": "No Operation, do nothing", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "No Operation, do nothing", - "type": "main", - "index": 0 - } - ] - ] - } - }, - "active": false, - "settings": { - "executionOrder": "v1" - }, - "versionId": "a60cd1b6-d52d-408c-9cc0-dd91c1477ee1", - "meta": { - "instanceId": "eeda9e3069aca300d1dfceeb64beb5b53d715db44a50461bbc5cb0cf6daa01e3" - }, - "id": "25lWZUaSQnoiwP7h", - "tags": [] -} diff --git a/packages/core/src/execution-engine/__tests__/workflows/paired_items_fix.json b/packages/core/src/execution-engine/__tests__/workflows/paired_items_fix.json index 863c65471d..dbd036f70c 100644 --- a/packages/core/src/execution-engine/__tests__/workflows/paired_items_fix.json +++ b/packages/core/src/execution-engine/__tests__/workflows/paired_items_fix.json @@ -21,11 +21,17 @@ }, { "parameters": { - "jsCode": "return []" + "conditions": { + "boolean": [ + { + "value1": true + } + ] + } }, - "id": "58198a44-6b5c-4ad1-a03b-8b9e319b6c1b", - "name": "Return no items", - "type": "n8n-nodes-base.code", + "id": "4d4af5e5-860d-416f-b2d7-f0f87f380355", + "name": "IF", + "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [1080, 500], "alwaysOutputData": true @@ -409,6 +415,17 @@ ] ] }, + "IF": { + "main": [ + [ + { + "node": "Set1", + "type": "main", + "index": 0 + } + ] + ] + }, "When clicking \"Execute Workflow\"": { "main": [ [ @@ -429,7 +446,7 @@ "main": [ [ { - "node": "Return no items", + "node": "IF", "type": "main", "index": 0 } @@ -535,17 +552,6 @@ } ] ] - }, - "Return no items": { - "main": [ - [ - { - "node": "Set1", - "type": "main", - "index": 0 - } - ] - ] } }, "active": false, diff --git a/packages/core/src/execution-engine/workflow-execute.ts b/packages/core/src/execution-engine/workflow-execute.ts index 2d47e78aa5..d6c721a08a 100644 --- a/packages/core/src/execution-engine/workflow-execute.ts +++ b/packages/core/src/execution-engine/workflow-execute.ts @@ -1777,10 +1777,8 @@ export class WorkflowExecute { }); nodeSuccessData = this.assignPairedItems(nodeSuccessData, executionData); - const noOutputData = - !nodeSuccessData || nodeSuccessData.every((data) => !data?.length); - if (noOutputData) { + if (!nodeSuccessData?.[0]?.[0]) { if (executionData.node.alwaysOutputData === true) { const pairedItem: IPairedItemData[] = [];