fix(ui): fix incorrect boards endpoint matchers being used

Should fix some stale-data issues with the auto-adding of images to selected boards, and deleting images from boards.
This commit is contained in:
psychedelicious 2023-06-24 11:07:34 +10:00
parent 8bacee115a
commit 13f25edb1e
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ import { imageMetadataReceived } from 'services/api/thunks/image';
import { sessionCanceled } from 'services/api/thunks/session'; import { sessionCanceled } from 'services/api/thunks/session';
import { isImageOutput } from 'services/api/guards'; import { isImageOutput } from 'services/api/guards';
import { progressImageSet } from 'features/system/store/systemSlice'; import { progressImageSet } from 'features/system/store/systemSlice';
import { api } from 'services/api'; import { boardImagesApi } from 'services/api/endpoints/boardImages';
const moduleLog = log.child({ namespace: 'socketio' }); const moduleLog = log.child({ namespace: 'socketio' });
const nodeDenylist = ['dataURL_image']; const nodeDenylist = ['dataURL_image'];
@ -61,7 +61,7 @@ export const addInvocationCompleteEventListener = () => {
if (boardIdToAddTo && !imageDTO.is_intermediate) { if (boardIdToAddTo && !imageDTO.is_intermediate) {
dispatch( dispatch(
api.endpoints.addImageToBoard.initiate({ boardImagesApi.endpoints.addImageToBoard.initiate({
board_id: boardIdToAddTo, board_id: boardIdToAddTo,
image_name, image_name,
}) })

View File

@ -1,6 +1,6 @@
import { PayloadAction, createSlice } from '@reduxjs/toolkit'; import { PayloadAction, createSlice } from '@reduxjs/toolkit';
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { api } from 'services/api'; import { boardsApi } from 'services/api/endpoints/boards';
type BoardsState = { type BoardsState = {
searchText: string; searchText: string;
@ -29,7 +29,7 @@ const boardsSlice = createSlice({
}, },
extraReducers: (builder) => { extraReducers: (builder) => {
builder.addMatcher( builder.addMatcher(
api.endpoints.deleteBoard.matchFulfilled, boardsApi.endpoints.deleteBoard.matchFulfilled,
(state, action) => { (state, action) => {
if (action.meta.arg.originalArgs === state.selectedBoardId) { if (action.meta.arg.originalArgs === state.selectedBoardId) {
state.selectedBoardId = undefined; state.selectedBoardId = undefined;