feat(web): add search query helpers (summary + 3 facet infinite queries)

createSearchQuery hits /api/search with limit=10 (the main /search
page summary). createSearchArtistsInfiniteQuery /
createSearchAlbumsInfiniteQuery / createSearchTracksInfiniteQuery each
hit /api/search with limit=50 and project to their own facet, used by
the per-facet overflow pages. All four are gated by q.length > 0 so
empty queries don't fire.
This commit is contained in:
2026-04-25 15:30:06 -04:00
parent 7dd77a4723
commit 7eb051c6f7
2 changed files with 81 additions and 1 deletions
+15
View File
@@ -15,3 +15,18 @@ describe('qk key generators', () => {
expect(qk.album('xyz')).toEqual(['album', 'xyz']);
});
});
describe('qk search keys', () => {
test('search summary key includes q', () => {
expect(qk.search('foo')).toEqual(['search', { q: 'foo' }]);
});
test('searchArtists key includes q', () => {
expect(qk.searchArtists('foo')).toEqual(['searchArtists', { q: 'foo' }]);
});
test('searchAlbums key includes q', () => {
expect(qk.searchAlbums('foo')).toEqual(['searchAlbums', { q: 'foo' }]);
});
test('searchTracks key includes q', () => {
expect(qk.searchTracks('foo')).toEqual(['searchTracks', { q: 'foo' }]);
});
});