diff --git a/invokeai/app/api/routers/style_presets.py b/invokeai/app/api/routers/style_presets.py index a785402fd4..dadd89debb 100644 --- a/invokeai/app/api/routers/style_presets.py +++ b/invokeai/app/api/routers/style_presets.py @@ -55,18 +55,6 @@ async def get_style_preset( raise HTTPException(status_code=404, detail="Style preset not found") -@style_presets_router.post( - "/i/{style_preset_id}", - operation_id="select_style_preset", -) -async def select_style_preset( - style_preset_id: str = Path(description="The style preset to select"), -) -> None: - """Selects a style preset, this will be used for saving recently used style presets""" - - return - - @style_presets_router.patch( "/i/{style_preset_id}", operation_id="update_style_preset", diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts index 3c1285221c..a1ce52b407 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/index.ts @@ -53,7 +53,6 @@ import type { AppDispatch, RootState } from 'app/store/store'; import { addArchivedOrDeletedBoardListener } from './listeners/addArchivedOrDeletedBoardListener'; import { addEnqueueRequestedUpscale } from './listeners/enqueueRequestedUpscale'; -import { addStylePresetSelectedListener } from './listeners/stylePresetSelected'; export const listenerMiddleware = createListenerMiddleware(); @@ -124,9 +123,6 @@ addImageRemovedFromBoardFulfilledListener(startAppListening); addBoardIdSelectedListener(startAppListening); addArchivedOrDeletedBoardListener(startAppListening); -// Style Presets -addStylePresetSelectedListener(startAppListening); - // Node schemas addGetOpenAPISchemaListener(startAppListening); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stylePresetSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stylePresetSelected.ts deleted file mode 100644 index fd8c9aae52..0000000000 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/stylePresetSelected.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; -import { activeStylePresetIdChanged } from 'features/stylePresets/store/stylePresetSlice'; -import { stylePresetsApi } from 'services/api/endpoints/stylePresets'; - -export const addStylePresetSelectedListener = (startAppListening: AppStartListening) => { - startAppListening({ - actionCreator: activeStylePresetIdChanged, - effect: async (action, { dispatch }) => { - if (!action.payload) { - return; - } - dispatch(stylePresetsApi.endpoints.selectStylePreset.initiate(action.payload)); - }, - }); -}; diff --git a/invokeai/frontend/web/src/services/api/endpoints/stylePresets.ts b/invokeai/frontend/web/src/services/api/endpoints/stylePresets.ts index 80f1971be8..44023b59d1 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/stylePresets.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/stylePresets.ts @@ -18,11 +18,15 @@ const buildStylePresetsUrl = (path: string = '') => buildV1Url(`style_presets/${ export const stylePresetsApi = api.injectEndpoints({ endpoints: (build) => ({ - selectStylePreset: build.mutation({ - query: (style_preset_id) => ({ - url: buildStylePresetsUrl(`i/${style_preset_id}`), - method: 'POST', - }), + getStylePreset: build.query< + paths['/api/v1/style_presets/i/{style_preset_id}']['get']['responses']['200']['content']['application/json'], + string + >({ + query: (style_preset_id) => buildStylePresetsUrl(`i/${style_preset_id}`), + providesTags: (result, error, style_preset_id) => [ + { type: 'StylePreset', id: style_preset_id }, + 'FetchOnReconnect', + ], }), deleteStylePreset: build.mutation({ query: (style_preset_id) => ({