From 977dbd80510f8cad50b786597c568cbe13724b6a Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Mon, 24 Jun 2024 14:27:06 -0400 Subject: [PATCH] clear selection when board or gallery view changes --- .../listenerMiddleware/listeners/boardIdSelected.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(