feat(ui): close viewer when adding a RG layer

This commit is contained in:
psychedelicious 2024-05-07 07:43:54 +10:00 committed by Kent Keirsey
parent 67d6cf19c6
commit b6c19a8e47

View File

@ -1,6 +1,7 @@
import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice, isAnyOf } from '@reduxjs/toolkit';
import type { PersistConfig, RootState } from 'app/store/store';
import { rgLayerAdded } from 'features/controlLayers/store/controlLayersSlice';
import { setActiveTab } from 'features/ui/store/uiSlice';
import { uniqBy } from 'lodash-es';
import { boardsApi } from 'services/api/endpoints/boards';
@ -89,6 +90,9 @@ export const gallerySlice = createSlice({
builder.addCase(setActiveTab, (state) => {
state.isImageViewerOpen = false;
});
builder.addCase(rgLayerAdded, (state) => {
state.isImageViewerOpen = false;
});
builder.addMatcher(isAnyBoardDeleted, (state, action) => {
const deletedBoardId = action.meta.arg.originalArgs;
if (deletedBoardId === state.selectedBoardId) {