fix(ui): reset initial image when resetting canvas

This commit is contained in:
psychedelicious 2024-07-15 19:35:15 +10:00
parent 4341ed7ab4
commit 9bc57a6f59

View File

@ -1,5 +1,5 @@
import type { PayloadAction } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit'; import { createAction, createSlice } from '@reduxjs/toolkit';
import type { PersistConfig, RootState } from 'app/store/store'; import type { PersistConfig, RootState } from 'app/store/store';
import { deepClone } from 'common/util/deepClone'; import { deepClone } from 'common/util/deepClone';
import { bboxReducers } from 'features/controlLayers/store/bboxReducers'; import { bboxReducers } from 'features/controlLayers/store/bboxReducers';
@ -172,6 +172,7 @@ export const canvasV2Slice = createSlice({
state.session = deepClone(initialState.session); state.session = deepClone(initialState.session);
state.tool = deepClone(initialState.tool); state.tool = deepClone(initialState.tool);
state.inpaintMask = deepClone(initialState.inpaintMask); state.inpaintMask = deepClone(initialState.inpaintMask);
state.initialImage = deepClone(initialState.initialImage);
}, },
}, },
}); });
@ -386,3 +387,5 @@ export const canvasV2PersistConfig: PersistConfig<CanvasV2State> = {
migrate, migrate,
persistDenylist: [], persistDenylist: [],
}; };
export const sessionRequested = createAction(`${canvasV2Slice.name}/sessionRequested`);