diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts index 9388bab722..e236141416 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts @@ -1,6 +1,6 @@ import { isAnyOf } from '@reduxjs/toolkit'; 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 { imagesApi } from 'services/api/endpoints/images'; @@ -22,6 +22,8 @@ export const addBoardIdSelectedListener = (startAppListening: AppStartListening) 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 // must use getState() to ensure we do not have stale state const isSuccess = await condition(