From 426b2f4f0b4c3c08f7b42ac5686ce3c0bece9e85 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Wed, 1 Apr 2026 21:36:19 +1300 Subject: [PATCH] fix: use fresh node data in executeOutputGallery to preserve batch images executeOutputGallery was reading gallery images from the stale node copy captured during topological sort. When upstream batch execution pushed images via appendOutputGalleryImage, the stale copy didn't reflect them, so the gallery was overwritten with only the last generated image. Co-Authored-By: Claude Sonnet 4.5 --- src/store/execution/simpleNodeExecutors.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/store/execution/simpleNodeExecutors.ts b/src/store/execution/simpleNodeExecutors.ts index 137c2e72..7ba3bafe 100644 --- a/src/store/execution/simpleNodeExecutors.ts +++ b/src/store/execution/simpleNodeExecutors.ts @@ -293,14 +293,17 @@ export async function executeOutput(ctx: NodeExecutionContext): Promise { * OutputGallery node: accumulates images from upstream nodes. */ export async function executeOutputGallery(ctx: NodeExecutionContext): Promise { - const { node, getConnectedInputs, updateNodeData } = ctx; + const { node, getConnectedInputs, updateNodeData, getFreshNode } = ctx; const { images } = getConnectedInputs(node.id); - const galleryData = node.data as OutputGalleryNodeData; - const existing = new Set(galleryData.images || []); + // Use fresh node data — the stale `node` from topological sort may be missing + // images pushed by appendOutputGalleryImage during upstream batch execution. + const freshNode = getFreshNode(node.id); + const galleryImages = ((freshNode?.data ?? node.data) as OutputGalleryNodeData).images || []; + const existing = new Set(galleryImages); const newImages = images.filter((img) => !existing.has(img)); if (newImages.length > 0) { updateNodeData(node.id, { - images: [...newImages, ...(galleryData.images || [])], + images: [...newImages, ...galleryImages], }); } }