mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): if deleting selected board, deselect it
This commit is contained in:
parent
f560a462a0
commit
26b75b85f7
@ -14,6 +14,7 @@ import {
|
|||||||
boardUpdated,
|
boardUpdated,
|
||||||
receivedBoards,
|
receivedBoards,
|
||||||
} from '../../../services/thunks/board';
|
} from '../../../services/thunks/board';
|
||||||
|
import { api } from 'services/apiSlice';
|
||||||
|
|
||||||
export const boardsAdapter = createEntityAdapter<BoardDTO>({
|
export const boardsAdapter = createEntityAdapter<BoardDTO>({
|
||||||
selectId: (board) => board.board_id,
|
selectId: (board) => board.board_id,
|
||||||
@ -92,6 +93,14 @@ const boardsSlice = createSlice({
|
|||||||
console.log({ boardId });
|
console.log({ boardId });
|
||||||
boardsAdapter.removeOne(state, boardId);
|
boardsAdapter.removeOne(state, boardId);
|
||||||
});
|
});
|
||||||
|
builder.addMatcher(
|
||||||
|
api.endpoints.deleteBoard.matchFulfilled,
|
||||||
|
(state, action) => {
|
||||||
|
if (action.meta.arg.originalArgs === state.selectedBoardId) {
|
||||||
|
state.selectedBoardId = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user