diff --git a/invokeai/frontend/web/src/app/store/store.ts b/invokeai/frontend/web/src/app/store/store.ts index d838a40eb1..7a2b8673a2 100644 --- a/invokeai/frontend/web/src/app/store/store.ts +++ b/invokeai/frontend/web/src/app/store/store.ts @@ -3,27 +3,28 @@ import { autoBatchEnhancer, combineReducers, configureStore } from '@reduxjs/too import { logger } from 'app/logging/logger'; import { idbKeyValDriver } from 'app/store/enhancers/reduxRemember/driver'; import { errorHandler } from 'app/store/enhancers/reduxRemember/errors'; -import canvasReducer, { canvasPersistConfig } from 'features/canvas/store/canvasSlice'; -import changeBoardModalReducer from 'features/changeBoardModal/store/slice'; -import controlAdaptersReducer, { +import { canvasPersistConfig, canvasSlice } from 'features/canvas/store/canvasSlice'; +import { changeBoardModalSlice } from 'features/changeBoardModal/store/slice'; +import { controlAdaptersPersistConfig, + controlAdaptersSlice, } from 'features/controlAdapters/store/controlAdaptersSlice'; -import deleteImageModalReducer from 'features/deleteImageModal/store/slice'; -import dynamicPromptsReducer, { dynamicPromptsPersistConfig } from 'features/dynamicPrompts/store/dynamicPromptsSlice'; -import galleryReducer, { galleryPersistConfig } from 'features/gallery/store/gallerySlice'; -import hrfReducer, { hrfPersistConfig } from 'features/hrf/store/hrfSlice'; -import loraReducer, { loraPersistConfig } from 'features/lora/store/loraSlice'; -import modelmanagerReducer, { modelManagerPersistConfig } from 'features/modelManager/store/modelManagerSlice'; -import nodesReducer, { nodesPersistConfig } from 'features/nodes/store/nodesSlice'; -import nodeTemplatesReducer from 'features/nodes/store/nodeTemplatesSlice'; -import workflowReducer, { workflowPersistConfig } from 'features/nodes/store/workflowSlice'; -import generationReducer, { generationPersistConfig } from 'features/parameters/store/generationSlice'; -import postprocessingReducer, { postprocessingPersistConfig } from 'features/parameters/store/postprocessingSlice'; -import queueReducer from 'features/queue/store/queueSlice'; -import sdxlReducer, { sdxlPersistConfig } from 'features/sdxl/store/sdxlSlice'; -import configReducer from 'features/system/store/configSlice'; -import systemReducer, { systemPersistConfig } from 'features/system/store/systemSlice'; -import uiReducer, { uiPersistConfig } from 'features/ui/store/uiSlice'; +import { deleteImageModalSlice } from 'features/deleteImageModal/store/slice'; +import { dynamicPromptsPersistConfig, dynamicPromptsSlice } from 'features/dynamicPrompts/store/dynamicPromptsSlice'; +import { galleryPersistConfig, gallerySlice } from 'features/gallery/store/gallerySlice'; +import { hrfPersistConfig, hrfSlice } from 'features/hrf/store/hrfSlice'; +import { loraPersistConfig, loraSlice } from 'features/lora/store/loraSlice'; +import { modelManagerPersistConfig, modelManagerSlice } from 'features/modelManager/store/modelManagerSlice'; +import { nodesPersistConfig, nodesSlice } from 'features/nodes/store/nodesSlice'; +import { nodesTemplatesSlice } from 'features/nodes/store/nodeTemplatesSlice'; +import { workflowPersistConfig, workflowSlice } from 'features/nodes/store/workflowSlice'; +import { generationPersistConfig, generationSlice } from 'features/parameters/store/generationSlice'; +import { postprocessingPersistConfig, postprocessingSlice } from 'features/parameters/store/postprocessingSlice'; +import { queueSlice } from 'features/queue/store/queueSlice'; +import { sdxlPersistConfig, sdxlSlice } from 'features/sdxl/store/sdxlSlice'; +import { configSlice } from 'features/system/store/configSlice'; +import { systemPersistConfig, systemSlice } from 'features/system/store/systemSlice'; +import { uiPersistConfig, uiSlice } from 'features/ui/store/uiSlice'; import { diff } from 'jsondiffpatch'; import { defaultsDeep, keys, omit, pick } from 'lodash-es'; import dynamicMiddlewares from 'redux-dynamic-middlewares'; @@ -39,26 +40,27 @@ import { actionSanitizer } from './middleware/devtools/actionSanitizer'; import { actionsDenylist } from './middleware/devtools/actionsDenylist'; import { stateSanitizer } from './middleware/devtools/stateSanitizer'; import { listenerMiddleware } from './middleware/listenerMiddleware'; + const allReducers = { - canvas: canvasReducer, - gallery: galleryReducer, - generation: generationReducer, - nodes: nodesReducer, - nodeTemplates: nodeTemplatesReducer, - postprocessing: postprocessingReducer, - system: systemReducer, - config: configReducer, - ui: uiReducer, - controlAdapters: controlAdaptersReducer, - dynamicPrompts: dynamicPromptsReducer, - deleteImageModal: deleteImageModalReducer, - changeBoardModal: changeBoardModalReducer, - lora: loraReducer, - modelmanager: modelmanagerReducer, - sdxl: sdxlReducer, - queue: queueReducer, - workflow: workflowReducer, - hrf: hrfReducer, + [canvasSlice.name]: canvasSlice.reducer, + [gallerySlice.name]: gallerySlice.reducer, + [generationSlice.name]: generationSlice.reducer, + [nodesSlice.name]: nodesSlice.reducer, + [nodesTemplatesSlice.name]: nodesTemplatesSlice.reducer, + [postprocessingSlice.name]: postprocessingSlice.reducer, + [systemSlice.name]: systemSlice.reducer, + [configSlice.name]: configSlice.reducer, + [uiSlice.name]: uiSlice.reducer, + [controlAdaptersSlice.name]: controlAdaptersSlice.reducer, + [dynamicPromptsSlice.name]: dynamicPromptsSlice.reducer, + [deleteImageModalSlice.name]: deleteImageModalSlice.reducer, + [changeBoardModalSlice.name]: changeBoardModalSlice.reducer, + [loraSlice.name]: loraSlice.reducer, + [modelManagerSlice.name]: modelManagerSlice.reducer, + [sdxlSlice.name]: sdxlSlice.reducer, + [queueSlice.name]: queueSlice.reducer, + [workflowSlice.name]: workflowSlice.reducer, + [hrfSlice.name]: hrfSlice.reducer, [api.reducerPath]: api.reducer, }; diff --git a/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts b/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts index 1a3c6cfd73..cd734d3f00 100644 --- a/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts +++ b/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts @@ -719,8 +719,6 @@ export const { scaledBoundingBoxDimensionsReset, } = canvasSlice.actions; -export default canvasSlice.reducer; - export const selectCanvasSlice = (state: RootState) => state.canvas; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/changeBoardModal/store/slice.ts b/invokeai/frontend/web/src/features/changeBoardModal/store/slice.ts index b585b2b697..4b374b066a 100644 --- a/invokeai/frontend/web/src/features/changeBoardModal/store/slice.ts +++ b/invokeai/frontend/web/src/features/changeBoardModal/store/slice.ts @@ -5,7 +5,7 @@ import type { ImageDTO } from 'services/api/types'; import { initialState } from './initialState'; -const changeBoardModal = createSlice({ +export const changeBoardModalSlice = createSlice({ name: 'changeBoardModal', initialState, reducers: { @@ -22,8 +22,6 @@ const changeBoardModal = createSlice({ }, }); -export const { isModalOpenChanged, imagesToChangeSelected, changeBoardReset } = changeBoardModal.actions; - -export default changeBoardModal.reducer; +export const { isModalOpenChanged, imagesToChangeSelected, changeBoardReset } = changeBoardModalSlice.actions; export const selectChangeBoardModalSlice = (state: RootState) => state.changeBoardModal; diff --git a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts index e037b871fd..49b07f16a1 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts +++ b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts @@ -424,8 +424,6 @@ export const { controlAdapterModelCleared, } = controlAdaptersSlice.actions; -export default controlAdaptersSlice.reducer; - export const isAnyControlAdapterAdded = isAnyOf( controlAdapterAdded, controlAdapterAddedFromImage, diff --git a/invokeai/frontend/web/src/features/deleteImageModal/store/slice.ts b/invokeai/frontend/web/src/features/deleteImageModal/store/slice.ts index 268602c350..9efb7c395f 100644 --- a/invokeai/frontend/web/src/features/deleteImageModal/store/slice.ts +++ b/invokeai/frontend/web/src/features/deleteImageModal/store/slice.ts @@ -5,7 +5,7 @@ import type { ImageDTO } from 'services/api/types'; import { initialDeleteImageState } from './initialState'; -const deleteImageModal = createSlice({ +export const deleteImageModalSlice = createSlice({ name: 'deleteImageModal', initialState: initialDeleteImageState, reducers: { @@ -22,8 +22,6 @@ const deleteImageModal = createSlice({ }, }); -export const { isModalOpenChanged, imagesToDeleteSelected, imageDeletionCanceled } = deleteImageModal.actions; - -export default deleteImageModal.reducer; +export const { isModalOpenChanged, imagesToDeleteSelected, imageDeletionCanceled } = deleteImageModalSlice.actions; export const selectDeleteImageModalSlice = (state: RootState) => state.deleteImageModal; diff --git a/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts b/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts index cb4709b711..7bb0b29659 100644 --- a/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts +++ b/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts @@ -74,8 +74,6 @@ export const { seedBehaviourChanged, } = dynamicPromptsSlice.actions; -export default dynamicPromptsSlice.reducer; - export const selectDynamicPromptsSlice = (state: RootState) => state.dynamicPrompts; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts index 53b8527b34..f351d91339 100644 --- a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts +++ b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts @@ -109,8 +109,6 @@ export const { moreImagesLoaded, } = gallerySlice.actions; -export default gallerySlice.reducer; - const isAnyBoardDeleted = isAnyOf( imagesApi.endpoints.deleteBoard.matchFulfilled, imagesApi.endpoints.deleteBoardAndImages.matchFulfilled diff --git a/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts b/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts index 36eefe0ce6..4c5769550b 100644 --- a/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts +++ b/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts @@ -37,8 +37,6 @@ export const hrfSlice = createSlice({ export const { setHrfEnabled, setHrfStrength, setHrfMethod } = hrfSlice.actions; -export default hrfSlice.reducer; - export const selectHrfSlice = (state: RootState) => state.hrf; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts index 2df882a1c5..b3c63f2e0f 100644 --- a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts +++ b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts @@ -81,8 +81,6 @@ export const { loraRecalled, } = loraSlice.actions; -export default loraSlice.reducer; - export const selectLoraSlice = (state: RootState) => state.lora; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/modelManager/store/modelManagerSlice.ts b/invokeai/frontend/web/src/features/modelManager/store/modelManagerSlice.ts index 4f6c5840e7..c450e64b3c 100644 --- a/invokeai/frontend/web/src/features/modelManager/store/modelManagerSlice.ts +++ b/invokeai/frontend/web/src/features/modelManager/store/modelManagerSlice.ts @@ -29,8 +29,6 @@ export const modelManagerSlice = createSlice({ export const { setSearchFolder, setAdvancedAddScanModel } = modelManagerSlice.actions; -export default modelManagerSlice.reducer; - export const selectModelManagerSlice = (state: RootState) => state.modelmanager; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/nodes/store/nodeTemplatesSlice.ts b/invokeai/frontend/web/src/features/nodes/store/nodeTemplatesSlice.ts index ac67b19e43..c211131aab 100644 --- a/invokeai/frontend/web/src/features/nodes/store/nodeTemplatesSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/nodeTemplatesSlice.ts @@ -9,7 +9,7 @@ export const initialNodeTemplatesState: NodeTemplatesState = { templates: {}, }; -const nodesTemplatesSlice = createSlice({ +export const nodesTemplatesSlice = createSlice({ name: 'nodeTemplates', initialState: initialNodeTemplatesState, reducers: { @@ -21,6 +21,4 @@ const nodesTemplatesSlice = createSlice({ export const { nodeTemplatesBuilt } = nodesTemplatesSlice.actions; -export default nodesTemplatesSlice.reducer; - export const selectNodeTemplatesSlice = (state: RootState) => state.nodeTemplates; diff --git a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts index e0291182b4..63d2d32360 100644 --- a/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/nodesSlice.ts @@ -139,7 +139,7 @@ const fieldValueReducer = ( input.value = result.data; }; -const nodesSlice = createSlice({ +export const nodesSlice = createSlice({ name: 'nodes', initialState: initialNodesState, reducers: { @@ -852,8 +852,6 @@ export const isAnyNodeOrEdgeMutation = isAnyOf( edgeAdded ); -export default nodesSlice.reducer; - export const selectNodesSlice = (state: RootState) => state.nodes; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/nodes/store/workflowSlice.ts b/invokeai/frontend/web/src/features/nodes/store/workflowSlice.ts index 7b33ee4d01..73802da54e 100644 --- a/invokeai/frontend/web/src/features/nodes/store/workflowSlice.ts +++ b/invokeai/frontend/web/src/features/nodes/store/workflowSlice.ts @@ -27,7 +27,7 @@ export const initialWorkflowState: WorkflowState = { ...blankWorkflow, }; -const workflowSlice = createSlice({ +export const workflowSlice = createSlice({ name: 'workflow', initialState: initialWorkflowState, reducers: { @@ -119,8 +119,6 @@ export const { workflowSaved, } = workflowSlice.actions; -export default workflowSlice.reducer; - export const selectWorkflowSlice = (state: RootState) => state.workflow; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts index 11bd656e6f..df98943cd3 100644 --- a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts @@ -299,8 +299,6 @@ export const { export const { selectOptimalDimension } = generationSlice.selectors; -export default generationSlice.reducer; - export const selectGenerationSlice = (state: RootState) => state.generation; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts index ee856bcb78..e014f60570 100644 --- a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts @@ -35,8 +35,6 @@ export const postprocessingSlice = createSlice({ export const { esrganModelNameChanged } = postprocessingSlice.actions; -export default postprocessingSlice.reducer; - export const selectPostprocessingSlice = (state: RootState) => state.postprocessing; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts index 43baa57bb2..340dff5104 100644 --- a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts +++ b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts @@ -53,6 +53,4 @@ export const { resumeProcessorOnEnqueueChanged, } = queueSlice.actions; -export default queueSlice.reducer; - export const selectQueueSlice = (state: RootState) => state.queue; diff --git a/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts b/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts index b630bc7912..efa5f1c8bd 100644 --- a/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts +++ b/invokeai/frontend/web/src/features/sdxl/store/sdxlSlice.ts @@ -36,7 +36,7 @@ export const initialSDXLState: SDXLState = { refinerStart: 0.8, }; -const sdxlSlice = createSlice({ +export const sdxlSlice = createSlice({ name: 'sdxl', initialState: initialSDXLState, reducers: { @@ -86,8 +86,6 @@ export const { setRefinerStart, } = sdxlSlice.actions; -export default sdxlSlice.reducer; - export const selectSdxlSlice = (state: RootState) => state.sdxl; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ diff --git a/invokeai/frontend/web/src/features/system/store/configSlice.ts b/invokeai/frontend/web/src/features/system/store/configSlice.ts index 948634e41b..1cf62e89c8 100644 --- a/invokeai/frontend/web/src/features/system/store/configSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/configSlice.ts @@ -177,6 +177,4 @@ export const configSlice = createSlice({ export const { configChanged } = configSlice.actions; -export default configSlice.reducer; - export const selectConfigSlice = (state: RootState) => state.config; diff --git a/invokeai/frontend/web/src/features/system/store/systemSlice.ts b/invokeai/frontend/web/src/features/system/store/systemSlice.ts index edbfa60616..589397e951 100644 --- a/invokeai/frontend/web/src/features/system/store/systemSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/systemSlice.ts @@ -194,8 +194,6 @@ export const { setShouldEnableInformationalPopovers, } = systemSlice.actions; -export default systemSlice.reducer; - const isAnyServerError = isAnyOf(socketInvocationError, socketSessionRetrievalError, socketInvocationRetrievalError); export const selectSystemSlice = (state: RootState) => state.system; diff --git a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts index b5c748dafd..32eb26673a 100644 --- a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts +++ b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts @@ -57,8 +57,6 @@ export const { expanderStateChanged, } = uiSlice.actions; -export default uiSlice.reducer; - export const selectUiSlice = (state: RootState) => state.ui; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */