clear book selection when navigating between libraries/shelves (#3073) (#3089)

This commit is contained in:
ACX
2026-02-27 17:21:24 -07:00
committed by GitHub
parent 8073e420e0
commit 84be7ee802
@@ -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<string, DetachedRouteHandle>();
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();
}
}