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:
@@ -40,7 +40,7 @@ export class AppBooksApiService {
|
||||
getNextPageParam: (lastPage: AppPageResponse<AppBookSummary>) =>
|
||||
lastPage.hasNext ? lastPage.page + 1 : undefined,
|
||||
enabled: !!this.token(),
|
||||
staleTime: 30_000,
|
||||
staleTime: 5 * 60_000,
|
||||
}));
|
||||
|
||||
readonly filterOptionsQuery = injectQuery(() => ({
|
||||
@@ -54,7 +54,7 @@ export class AppBooksApiService {
|
||||
return lastValueFrom(this.http.get<AppFilterOptions>(this.filterOptionsUrl, {params}));
|
||||
},
|
||||
enabled: !!this.token(),
|
||||
staleTime: 60_000,
|
||||
staleTime: 10 * 60_000,
|
||||
}));
|
||||
|
||||
/** Accumulated books from all loaded pages, mapped to the Book interface. */
|
||||
|
||||
@@ -5,7 +5,7 @@ import {TranslocoService} from '@jsverse/transloco';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
|
||||
import {createAuthServiceStub, createQueryClientHarness, flushSignalAndQueryEffects} from '../../../core/testing/query-testing';
|
||||
import {createAuthServiceStub, createQueryClientHarness, flushSignalAndQueryEffects, flushQueryAsync} from '../../../core/testing/query-testing';
|
||||
import type {Book, BookMetadata} from '../model/book.model';
|
||||
import type {Shelf} from '../model/shelf.model';
|
||||
import {AuthService} from '../../../shared/service/auth.service';
|
||||
@@ -46,12 +46,7 @@ function buildBook(id: number, overrides: BuildBookOverrides = {}): Book {
|
||||
}
|
||||
|
||||
async function flushBooksQuery(): Promise<void> {
|
||||
await Promise.resolve();
|
||||
flushSignalAndQueryEffects();
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
flushSignalAndQueryEffects();
|
||||
await Promise.resolve();
|
||||
flushSignalAndQueryEffects();
|
||||
await flushQueryAsync();
|
||||
}
|
||||
|
||||
describe('BookService', () => {
|
||||
|
||||
@@ -103,7 +103,7 @@ export class BookService {
|
||||
return queryOptions({
|
||||
queryKey: BOOKS_QUERY_KEY,
|
||||
queryFn: () => lastValueFrom(this.http.get<Book[]>(this.url, {params: {stripForListView: false}})),
|
||||
staleTime: 30_000,
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user