From 27277e1fd64d073ef049fd0e878b89f19266ab37 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 10 Jan 2025 09:15:03 +1000 Subject: [PATCH] docs(ui): improved comments for image batch node special handling --- .../listenerMiddleware/listeners/enqueueRequestedNodes.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts index 1964aa7ef2..2a6ace46f2 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts @@ -33,14 +33,18 @@ export const addEnqueueRequestedNodes = (startAppListening: AppStartListening) = const data: Batch['data'] = []; - // Skip edges from batch nodes - these should not be in the graph, they exist only in the UI + // Grab image batch nodes for special handling const imageBatchNodes = nodes.nodes.filter(isInvocationNode).filter((node) => node.data.type === 'image_batch'); + for (const node of imageBatchNodes) { + // Satisfy TS const images = node.data.inputs['images']; if (!isImageFieldCollectionInputInstance(images)) { log.warn({ nodeId: node.id }, 'Image batch images field is not an image collection'); break; } + + // Find outgoing edges from the batch node, we will remove these from the graph and create batch data collection items from them instead const edgesFromImageBatch = nodes.edges.filter((e) => e.source === node.id && e.sourceHandle === 'image'); const batchDataCollectionItem: NonNullable[number] = []; for (const edge of edgesFromImageBatch) {