From cec8840038ba895953a70f615a944635ad861bfe Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 9 May 2024 08:13:08 +1000 Subject: [PATCH] fix(ui): handle disabled RG layers Was missing a check for `layer.isEnabled`. --- .../nodes/util/graph/addControlLayersToGraph.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/util/graph/addControlLayersToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addControlLayersToGraph.ts index 6f249fd522..607cda786d 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graph/addControlLayersToGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/addControlLayersToGraph.ts @@ -679,29 +679,23 @@ const isValidIPAdapter = (ipa: IPAdapterConfigV2, base: BaseModelType): boolean }; const isValidLayer = (layer: Layer, base: BaseModelType) => { + if (!layer.isEnabled) { + return false; + } if (isControlAdapterLayer(layer)) { - if (!layer.isEnabled) { - return false; - } return isValidControlAdapter(layer.controlAdapter, base); } if (isIPAdapterLayer(layer)) { - if (!layer.isEnabled) { - return false; - } return isValidIPAdapter(layer.ipAdapter, base); } if (isInitialImageLayer(layer)) { - if (!layer.isEnabled) { - return false; - } if (!layer.image) { return false; } return true; } if (isRegionalGuidanceLayer(layer)) { - const hasTextPrompt = Boolean(layer.positivePrompt || layer.negativePrompt); + const hasTextPrompt = Boolean(layer.positivePrompt) || Boolean(layer.negativePrompt); const hasIPAdapter = layer.ipAdapters.filter((ipa) => isValidIPAdapter(ipa, base)).length > 0; return hasTextPrompt || hasIPAdapter; }