From e30c78febeac8bfcfbe5f1c4c13122594d8a518e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 4 Oct 2022 14:05:46 +0200 Subject: [PATCH] fix(editor): fix `pairedItem` in combination with pinned data (#4257) :bug: Fix `pairedItem` in combination with pinned data --- .../src/components/mixins/workflowHelpers.ts | 13 +++++++++++++ packages/workflow/src/WorkflowDataProxy.ts | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/mixins/workflowHelpers.ts b/packages/editor-ui/src/components/mixins/workflowHelpers.ts index e3f237776f..d8430a7432 100644 --- a/packages/editor-ui/src/components/mixins/workflowHelpers.ts +++ b/packages/editor-ui/src/components/mixins/workflowHelpers.ts @@ -78,6 +78,19 @@ export const workflowHelpers = mixins( // which does not use the node name const parentNodeName = parentNode[0]; + const parentPinData = this.$store.getters.pinData[parentNodeName]; + + // populate `executeData` from `pinData` + + if (parentPinData) { + executeData.data = { main: [parentPinData] }; + executeData.source = { main: [{ previousNode: parentNodeName }] }; + + return executeData; + } + + // populate `executeData` from `runData` + const workflowRunData = this.$store.getters.getWorkflowRunData as IRunData | null; if (workflowRunData === null) { return executeData; diff --git a/packages/workflow/src/WorkflowDataProxy.ts b/packages/workflow/src/WorkflowDataProxy.ts index adf4a8dd55..84ee662739 100644 --- a/packages/workflow/src/WorkflowDataProxy.ts +++ b/packages/workflow/src/WorkflowDataProxy.ts @@ -668,10 +668,18 @@ export class WorkflowDataProxy { }; } + const previousNodeHasPinData = + sourceData && this.workflow.getPinDataOfNode(sourceData.previousNode) !== undefined; + let currentPairedItem = pairedItem; let nodeBeforeLast: string | undefined; - while (sourceData !== null && destinationNodeName !== sourceData.previousNode) { + + while ( + !previousNodeHasPinData && + sourceData !== null && + destinationNodeName !== sourceData.previousNode + ) { taskData = that.runExecutionData!.resultData.runData[sourceData.previousNode][ sourceData?.previousNodeRun || 0