clear selection when board or gallery view changes

This commit is contained in:
Mary Hipp 2024-06-24 14:27:06 -04:00
parent 14250a0593
commit 977dbd8051

View File

@ -1,6 +1,6 @@
import { isAnyOf } from '@reduxjs/toolkit'; import { isAnyOf } from '@reduxjs/toolkit';
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'; import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
import { boardIdSelected, galleryViewChanged, imageSelected } from 'features/gallery/store/gallerySlice'; import { boardIdSelected, galleryViewChanged, imageSelected, selectionChanged } from 'features/gallery/store/gallerySlice';
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
import { imagesApi } from 'services/api/endpoints/images'; import { imagesApi } from 'services/api/endpoints/images';
@ -22,6 +22,8 @@ export const addBoardIdSelectedListener = (startAppListening: AppStartListening)
const queryArgs = { board_id: board_id ?? 'none', categories }; const queryArgs = { board_id: board_id ?? 'none', categories };
dispatch(selectionChanged([]))
// wait until the board has some images - maybe it already has some from a previous fetch // wait until the board has some images - maybe it already has some from a previous fetch
// must use getState() to ensure we do not have stale state // must use getState() to ensure we do not have stale state
const isSuccess = await condition( const isSuccess = await condition(