Files
grimmory/frontend/src/app/features/book/components/book-browser/book-browser-scroll.service.ts
T
brios 85e8d235b6 fix(dashboard): improve performance with OnPush change detection (#440)
* fix(dashboard): improve performance with OnPush change detection

* fix(dashboard): refactor book card component for improved readability and performance

* fix(tests): mock matchMedia for improved test compatibility

* fix(tests): matchMedia mock for better CI compatibility and support

* fix(dashboard): add clearAll method to BookBrowserScrollService and update tests

* fix(dashboard): improve performance with content visibility and refactor styles

* fix(dashboard): improve scroll performance with estimated total height and refactor layout

* fix(tests): add mock for getCurrentUser in userService for improved test coverage

* fix(dashboard): implement infinite scroll for book loading and scroll restoration

* fix(tests): fix lint error

* fix(tests): mock ResizeObserver and IntersectionObserver

* fix(tests): mock ResizeObserver and IntersectionObserver (again)

* fix(dashboard): improve accessibility and performance by updating aria attributes and optimizing animations

* fix(dashboard): improve submenu accessibility and optimize virtual scroller performance

* fix(dashboard): clean up imports and improve component structure

* fix(dashboard): correct mobile check in author browser component

* fix(dashboard): add OnDestroy lifecycle hook to BookBrowserComponent
2026-04-22 17:27:11 -04:00

30 lines
706 B
TypeScript

import {Injectable} from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class BookBrowserScrollService {
private scrollPositions = new Map<string, number>();
savePosition(key: string, position: number): void {
this.scrollPositions.set(key, position);
}
getPosition(key: string): number | undefined {
return this.scrollPositions.get(key);
}
clearPosition(key: string): void {
this.scrollPositions.delete(key);
}
clearAll(): void {
this.scrollPositions.clear();
}
createKey(path: string, params: Record<string, string>): string {
const paramValues = Object.values(params).join('-');
return paramValues ? `${path}:${paramValues}` : path;
}
}