Browse Source

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 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 3 months ago
parent
commit
426b2f4f0b
  1. 11
      src/store/execution/simpleNodeExecutors.ts

11
src/store/execution/simpleNodeExecutors.ts

@ -293,14 +293,17 @@ export async function executeOutput(ctx: NodeExecutionContext): Promise<void> {
* OutputGallery node: accumulates images from upstream nodes.
*/
export async function executeOutputGallery(ctx: NodeExecutionContext): Promise<void> {
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],
});
}
}

Loading…
Cancel
Save