fix(ui): update board totals when generation completes

This commit is contained in:
psychedelicious
2025-08-15 16:23:10 +10:00
parent a8a07598c8
commit 97a16c455c

View File

@@ -5,6 +5,7 @@ import {
selectAutoSwitch,
selectGalleryView,
selectGetImageNamesQueryArgs,
selectListBoardsQueryArgs,
selectSelectedBoardId,
} from 'features/gallery/store/gallerySelectors';
import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice';
@@ -76,6 +77,14 @@ export const buildOnInvocationComplete = (
}
dispatch(boardsApi.util.upsertQueryEntries(entries));
dispatch(
boardsApi.util.updateQueryData('listAllBoards', selectListBoardsQueryArgs(getState()), (draft) => {
for (const board of draft) {
board.image_count = board.image_count + (boardTotalAdditions[board.board_id] ?? 0);
}
})
);
/**
* Optimistic update and cache invalidation for image names queries that match this image's board and categories.
* - Optimistic update for the cache that does not have a search term (we cannot derive the correct insertion