From 952a7a86741a57477e7ae7559554fcc8d44bae53 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat, 15 Jul 2023 18:44:53 +1000 Subject: [PATCH] feat(ui): do not autoprocess if user just disabled autoconfig --- .../listeners/controlNetAutoProcess.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts index dd2fb6f469..a923bd0b60 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/controlNetAutoProcess.ts @@ -13,7 +13,11 @@ import { RootState } from 'app/store/store'; const moduleLog = log.child({ namespace: 'controlNet' }); -const predicate: AnyListenerPredicate = (action, state) => { +const predicate: AnyListenerPredicate = ( + action, + state, + prevState +) => { const isActionMatched = controlNetProcessorParamsChanged.match(action) || controlNetModelChanged.match(action) || @@ -25,6 +29,16 @@ const predicate: AnyListenerPredicate = (action, state) => { return false; } + if (controlNetAutoConfigToggled.match(action)) { + // do not process if the user just disabled auto-config + if ( + prevState.controlNet.controlNets[action.payload.controlNetId] + .shouldAutoConfig === true + ) { + return false; + } + } + const { controlImage, processorType, shouldAutoConfig } = state.controlNet.controlNets[action.payload.controlNetId];