From 043f9d9ba423d3763095a0b51a8d3893f7ef1836 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 29 May 2023 16:03:31 +1000 Subject: [PATCH] fix(ui): fix auto-switch to new images --- .../web/src/features/gallery/store/gallerySlice.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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 {