fix(ui): restore missing galleryImageClicked reducer

This commit is contained in:
psychedelicious 2024-02-06 21:45:13 +11:00
parent 183945077d
commit 54e46faa54

View File

@ -1,6 +1,7 @@
import type { PayloadAction } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit';
import type { PersistConfig, RootState } from 'app/store/store'; import type { PersistConfig, RootState } from 'app/store/store';
import { galleryImageClicked } from 'features/gallery/store/gallerySlice';
import { initialImageChanged } from 'features/parameters/store/generationSlice'; import { initialImageChanged } from 'features/parameters/store/generationSlice';
import type { InvokeTabName } from './tabMap'; import type { InvokeTabName } from './tabMap';
@ -49,6 +50,14 @@ export const uiSlice = createSlice({
builder.addCase(initialImageChanged, (state) => { builder.addCase(initialImageChanged, (state) => {
state.activeTab = 'img2img'; state.activeTab = 'img2img';
}); });
builder.addCase(galleryImageClicked, (state) => {
// When a gallery image is clicked and we are in progress mode, switch to image mode.
// This is not the same as the gallery _selection_ being changed.
if (state.viewerMode === 'progress') {
state.viewerMode = 'image';
}
});
}, },
}); });