diff --git a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts index 16121b6e38..ab62646c0f 100644 --- a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts +++ b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts @@ -1,6 +1,7 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit'; import { ImageDTO } from 'services/api'; +import { imageUpserted } from './imagesSlice'; type GalleryImageObjectFitType = 'contain' | 'cover'; @@ -47,6 +48,13 @@ export const gallerySlice = createSlice({ state.shouldUseSingleGalleryColumn = action.payload; }, }, + extraReducers: (builder) => { + builder.addCase(imageUpserted, (state, action) => { + if (state.shouldAutoSwitchToNewImages) { + state.selectedImage = action.payload; + } + }); + }, }); export const {