diff --git a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts index 8baf7cdabe..36e02edadc 100644 --- a/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/addControlNetToLinearGraph.ts @@ -1,5 +1,5 @@ import { RootState } from 'app/store/store'; -import { forEach, size } from 'lodash-es'; +import { filter, forEach, size } from 'lodash-es'; import { CollectInvocation, ControlNetInvocation } from 'services/api'; import { NonNullableGraph } from '../types/types'; @@ -12,10 +12,13 @@ export const addControlNetToLinearGraph = ( ): void => { const { isEnabled: isControlNetEnabled, controlNets } = state.controlNet; - const controlNetCount = size(controlNets); + const validControlNets = filter( + controlNets, + (c) => c.isEnabled && Boolean(c.processedControlImage) + ); // Add ControlNet - if (isControlNetEnabled && controlNetCount > 0) { + if (isControlNetEnabled && validControlNets.length > 0) { if (size(controlNets) > 1) { const controlNetIterateNode: CollectInvocation = { id: CONTROL_NET_COLLECT,