From 96671d12bdebfb81271b6d72371de95cbd00a40f Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:11:16 +1100 Subject: [PATCH] fix(ui): filter out batch nodes when checking readiness on workflows tab --- .../web/src/features/nodes/util/graph/buildNodesGraph.ts | 2 +- .../frontend/web/src/features/queue/store/readiness.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts index 20319ab5f7..f4f4a88d58 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts @@ -9,7 +9,7 @@ import { v4 as uuidv4 } from 'uuid'; const log = logger('workflows'); // These nodes are not executable, they exist for the frontend only -const filterNonExecutableNodes = (node: InvocationNode) => { +export const filterNonExecutableNodes = (node: InvocationNode) => { if (node.data.type === 'image_batch') { return false; } diff --git a/invokeai/frontend/web/src/features/queue/store/readiness.ts b/invokeai/frontend/web/src/features/queue/store/readiness.ts index 5a2f127a96..b7e8d2d3e5 100644 --- a/invokeai/frontend/web/src/features/queue/store/readiness.ts +++ b/invokeai/frontend/web/src/features/queue/store/readiness.ts @@ -34,6 +34,7 @@ import { validateStringFieldCollectionValue, } from 'features/nodes/types/fieldValidators'; import { isInvocationNode } from 'features/nodes/types/invocation'; +import { filterNonExecutableNodes } from 'features/nodes/util/graph/buildNodesGraph'; import type { UpscaleState } from 'features/parameters/store/upscaleSlice'; import { selectUpscaleSlice } from 'features/parameters/store/upscaleSlice'; import { selectConfigSlice } from 'features/system/store/configSlice'; @@ -75,11 +76,13 @@ const getReasonsWhyCannotEnqueueWorkflowsTab = (arg: { } if (workflowSettings.shouldValidateGraph) { - if (!nodes.nodes.length) { + const nodesToCheck = nodes.nodes.filter(isInvocationNode).filter(filterNonExecutableNodes); + + if (!nodesToCheck.length) { reasons.push({ content: i18n.t('parameters.invoke.noNodesInGraph') }); } - nodes.nodes.forEach((node) => { + nodesToCheck.forEach((node) => { if (!isInvocationNode(node)) { return; }