From 84be7ee80280c95448673c78813ff516a3f1c20c Mon Sep 17 00:00:00 2001 From: ACX <8075870+acx10@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:21:24 -0700 Subject: [PATCH] clear book selection when navigating between libraries/shelves (#3073) (#3089) --- booklore-ui/src/app/core/custom-reuse-strategy.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/booklore-ui/src/app/core/custom-reuse-strategy.ts b/booklore-ui/src/app/core/custom-reuse-strategy.ts index 209bb49a3..45f1e30c6 100644 --- a/booklore-ui/src/app/core/custom-reuse-strategy.ts +++ b/booklore-ui/src/app/core/custom-reuse-strategy.ts @@ -1,6 +1,7 @@ import {inject, Injectable} from '@angular/core'; import {ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy} from '@angular/router'; import {BookBrowserScrollService} from '../features/book/components/book-browser/book-browser-scroll.service'; +import {BookSelectionService} from '../features/book/components/book-browser/book-selection.service'; @Injectable({ providedIn: 'root', @@ -8,6 +9,7 @@ import {BookBrowserScrollService} from '../features/book/components/book-browser export class CustomReuseStrategy implements RouteReuseStrategy { private storedRoutes = new Map(); private scrollService = inject(BookBrowserScrollService); + private bookSelectionService = inject(BookSelectionService); private readonly BOOK_BROWSER_PATHS = [ 'all-books', @@ -39,6 +41,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy { if (handle && this.isBookBrowserRoute(route)) { const key = this.getRouteKey(route); this.storedRoutes.set(key, handle); + this.bookSelectionService.deselectAll(); } }