The genre and year drill-downs hand-rolled their own pager (a request token to drop late answers, loading, failed and later-page-failed flags), on the note that the codebase had no way to make a query from a changing URL. The search pages have since done exactly that: $derived(q ? createXInfiniteQuery(q) : null). browse.ts gains createAlbumsByGenreInfiniteQuery and createAlbumsByYearInfiniteQuery, keyed per selection so a late page for the previous one never lands in the current list. Both pages draw their albums through one AlbumDrillDown view (back link, count, grid, ListContinuation), and the out-of-date note is gone. Tests drive the pages through mockInfiniteQuery, as the search pages' do, with the page() fixture now in test-utils. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 lines
239 B
TypeScript
7 lines
239 B
TypeScript
import type { Page } from '#lib/api/types.js';
|
|
|
|
/** A Page<T> envelope, as the server sends a paged list. */
|
|
export function page<T>(items: T[], total: number, offset = 0, limit = 50): Page<T> {
|
|
return { items, total, offset, limit };
|
|
}
|