From c760c6329a20ab3f8ba48a6ab40ccf14543b7d18 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Thu, 2 Apr 2026 06:04:36 +1300 Subject: [PATCH] fix: derive array batch behavior dynamically from source node batchMode Edge metadata (arrayBatchAll) was stamped at connection creation time and went stale if the source node's batchMode was toggled later. Now connectedInputs.ts reads batchMode directly from the source node, making batch behavior always consistent with the current toggle state. Co-Authored-By: Claude Sonnet 4.5 --- src/store/utils/connectedInputs.ts | 3 ++- src/store/workflowStore.ts | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/store/utils/connectedInputs.ts b/src/store/utils/connectedInputs.ts index d5250e21..563699a1 100644 --- a/src/store/utils/connectedInputs.ts +++ b/src/store/utils/connectedInputs.ts @@ -229,7 +229,8 @@ export function getConnectedInputsPure( if (dimmedNodeIds && dimmedNodeIds.has(sourceNode.id)) return; // Array batch mode — send all items as textItems instead of a single item - if (sourceNode.type === "array" && (edge.data as Record | undefined)?.arrayBatchAll === true) { + // Derive from source node's current batchMode (not edge metadata which can go stale) + if (sourceNode.type === "array" && (sourceNode.data as ArrayNodeData).batchMode === true) { const arrayData = sourceNode.data as ArrayNodeData; const items = arrayData.outputItems; if (items.length > 0) { diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index a76508cf..5ec2c5d3 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -146,11 +146,8 @@ function buildConnectionEdgeData( if (sourceNode?.type === "array" && (connection.sourceHandle || "text") === "text") { const sourceData = sourceNode.data as Record; - // Batch mode: all items sent through a single connection - if (sourceData.batchMode === true) { - baseData.arrayBatchAll = true; - return baseData; - } + // Batch mode is now derived dynamically in connectedInputs.ts from + // the source node's batchMode — no need to stamp edge metadata. const selectedIndex = sourceData.selectedOutputIndex; const outputItems = Array.isArray(sourceData.outputItems) ? sourceData.outputItems : [];