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
This commit is contained in:
brios
2026-04-22 17:27:11 -04:00
committed by Zach Yale
parent a779de8f57
commit 85e8d235b6
140 changed files with 1546 additions and 1233 deletions
+21 -1
View File
@@ -1,4 +1,4 @@
import {signal, type EnvironmentProviders, type Provider, type WritableSignal} from '@angular/core';
import {ApplicationRef, provideZonelessChangeDetection, signal, type EnvironmentProviders, type Provider, type WritableSignal} from '@angular/core';
import {provideHttpClient} from '@angular/common/http';
import {provideHttpClientTesting} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing';
@@ -28,6 +28,7 @@ export function createQueryClientHarness(): QueryClientHarness {
return {
queryClient,
providers: [
provideZonelessChangeDetection(),
provideHttpClient(),
provideHttpClientTesting(),
provideTanStackQuery(queryClient),
@@ -38,3 +39,22 @@ export function createQueryClientHarness(): QueryClientHarness {
export function flushSignalAndQueryEffects(): void {
TestBed.flushEffects();
}
/**
* Asynchronously flushes Angular effects and query state across multiple rounds.
* Use this for tests involving async operations like HTTP requests or timers.
* For synchronous signal/effect flushing, use `flushSignalAndQueryEffects()` instead.
*
* @param rounds Number of cycles to await macrotask and microtask resolutions. Defaults to 5.
*/
export async function flushQueryAsync(rounds = 5): Promise<void> {
const appRef = TestBed.inject(ApplicationRef);
for (let i = 0; i < rounds; i++) {
TestBed.flushEffects();
appRef.tick();
await Promise.resolve();
await new Promise(resolve => setTimeout(resolve, 0));
}
TestBed.flushEffects();
appRef.tick();
}