From 3e813ead1f36315126e79fbc0a6c6ad49c18c7ae Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sat, 16 Sep 2023 16:08:04 +1200 Subject: [PATCH] chore: extract the adapter info initial state --- .../controlNet/store/controlNetSlice.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts b/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts index 60b326226b..df55c44cf3 100644 --- a/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts +++ b/invokeai/frontend/web/src/features/controlNet/store/controlNetSlice.ts @@ -74,16 +74,18 @@ export type ControlNetState = { ipAdapterInfo: IPAdapterConfig; }; +export const initialIPAdapterState: IPAdapterConfig = { + adapterImage: null, + model: null, + weight: 1, +}; + export const initialControlNetState: ControlNetState = { controlNets: {}, isEnabled: false, pendingControlImages: [], isIPAdapterEnabled: false, - ipAdapterInfo: { - adapterImage: null, - model: null, - weight: 1, - }, + ipAdapterInfo: { ...initialIPAdapterState }, }; export const controlNetSlice = createSlice({ @@ -388,11 +390,7 @@ export const controlNetSlice = createSlice({ }, ipAdapterStateReset: (state) => { state.isIPAdapterEnabled = false; - state.ipAdapterInfo = { - adapterImage: null, - model: null, - weight: 1, - }; + state.ipAdapterInfo = { ...initialIPAdapterState }; }, }, extraReducers: (builder) => {