feat(ui): command palette uses server-side book search #4

Merged
zombor merged 1 commit from bd-grimmory-n55.6 into develop 2026-05-11 00:53:46 +00:00
Owner

Summary

Bead: grimmory-n55.6 (part of epic grimmory-n55 — Scale to tens of thousands of books)

command-palette.service.ts filtered this.bookService.books() in memory, which only works while the full catalog is loaded client-side. The epic's goal is to retire that global signal, so the palette switches to server-side search via the existing AppBooksApiService.searchBooks endpoint.

What changed

  • command-palette.service.ts: 150ms debounce, size=20 cap, keepPreviousData for stale-while-loading. Preserves keyboard navigation, grouped sections, and select-to-navigate. isSearching reflects both debounce-pending and in-flight state.
  • command-palette.service.spec.ts: rewritten with HttpTestingController. Covers debounce coalescing (no per-keystroke fetch), empty/1-char no-network, graceful error handling, selection-navigates, audiobook thumbnails.

Test plan

  • 12/12 feature specs pass.
  • Pre-existing magic-shelf date failures reproduce on develop (unrelated to this PR).
  • just ui check — not run by agent; CI will verify.
  • Manually exercise the palette in dev against the prod server: type queries, observe single debounced request, navigate via keyboard.
## Summary Bead: **grimmory-n55.6** (part of epic **grimmory-n55** — Scale to tens of thousands of books) `command-palette.service.ts` filtered `this.bookService.books()` in memory, which only works while the full catalog is loaded client-side. The epic's goal is to retire that global signal, so the palette switches to server-side search via the existing `AppBooksApiService.searchBooks` endpoint. ## What changed - `command-palette.service.ts`: 150ms debounce, `size=20` cap, `keepPreviousData` for stale-while-loading. Preserves keyboard navigation, grouped sections, and select-to-navigate. `isSearching` reflects both debounce-pending and in-flight state. - `command-palette.service.spec.ts`: rewritten with `HttpTestingController`. Covers debounce coalescing (no per-keystroke fetch), empty/1-char no-network, graceful error handling, selection-navigates, audiobook thumbnails. ## Test plan - [x] 12/12 feature specs pass. - [ ] Pre-existing magic-shelf date failures reproduce on `develop` (unrelated to this PR). - [ ] `just ui check` — not run by agent; CI will verify. - [ ] Manually exercise the palette in dev against the prod server: type queries, observe single debounced request, navigate via keyboard.
feat(ui): command palette uses server-side book search
Some checks failed
notify-discord-release-notes.yml / feat(ui): command palette uses server-side book search (push) Failing after 0s
notify-discord-release-notes.yml / feat(ui): command palette uses server-side book search (pull_request) Failing after 0s
CI - Validate / Upload Event File (pull_request) Failing after 3s
CI - Frontend Quality Thresholds / Frontend Lint Threshold Check (pull_request) Failing after 12m15s
CI - Semantic PR Title / Validate PR Title (pull_request) Successful in 3m16s
CodeQL / Analyze (actions) (pull_request) Failing after 3m16s
CodeQL / Analyze (javascript-typescript) (pull_request) Failing after 3m16s
CodeQL / Analyze (java-kotlin) (pull_request) Failing after 3m17s
CI - Validate / Check for DB Migrations (pull_request) Successful in 3m21s
CI - Validate / Flyway DB Migration Preview (pull_request) Has been skipped
CI - Validate / Flyway Migration Check (pull_request) Successful in 0s
CI - Validate / Backend Tests (pull_request) Failing after 2s
CI - Validate / Frontend Tests (pull_request) Failing after 3s
CI - Validate / Test Suite (pull_request) Failing after 0s
CI - Validate / Packaging Smoke Test (pull_request) Has been skipped
notify-discord-release-notes.yml / Merge pull request 'feat(ui): command palette uses server-side book search' (#4) from bd-grimmory-n55.6 into develop (pull_request) Failing after 0s
8ba81e753f
Replace the in-memory filterBooksBySearchTerm against bookService.books()
with a debounced TanStack query against /api/v1/app/books/search. The
palette no longer depends on the global catalog signal, advancing the
n55 epic toward retiring bookService.books().

- 150ms debounce + distinctUntilChanged on the trimmed query
- 20-result cap per call (?size=20)
- keepPreviousData so stale results stay on screen while a new request
  is in flight; isSearching also reflects in-flight fetches so the
  empty-state message is suppressed during loading
- search errors are swallowed into an empty page so the palette stays
  usable; navigation, grouped sections, and keyboard nav are untouched
- spec rewritten with HttpTestingController: debounce coalescing, empty
  query bypass, error graceful fallback, selection-navigates, audiobook
  thumbnails

Bead: grimmory-n55.6

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zombor merged commit cfaa082c6b into develop 2026-05-11 00:53:46 +00:00
zombor deleted branch bd-grimmory-n55.6 2026-05-11 00:53:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zombor/grimmory!4
No description provided.