Skip to content

feat(genre-tree)!: load reference tree in one request, return arrays - #187

Merged
Andreas-Garcia merged 1 commit into
developfrom
feature/genre-tree-single-request
Oct 3, 2026
Merged

Andreas-Garcia merged 1 commit into
developfrom
feature/genre-tree-single-request

Conversation

@Andreas-Garcia

Copy link
Copy Markdown
Member

Summary

The genre tree took about 13 s to load. The reference tree (about 1,712 genre playlists) was fetched as about 18 pages of 100 rows, which queued behind grow-api's 2 sync workers; the fan-out has also OOM-killed the proxy before. grow-api v11.1.0 now serves the whole reference tree, cached and ETag'd, at GET /v1/genre-playlists/tree/?treeName=canonical. With this change app-kit loads the reference tree in one request.

Changes

  • genrePlaylistEndpoints.reference.tree() → genre-playlists/tree/.
  • useListFullGenrePlaylists:
    • reference makes a single fetch with { treeName: "canonical" } and parses it with z.array(CriteriaPlaylistSimpleSchema).
    • me (hear-api has no tree endpoint) still uses fetchAllPages, with FULL_LIST_CONCURRENCY = 4. fetchAllPages now returns the merged rows rather than a fake one-page envelope.
  • BREAKING: both scopes now resolve to CriteriaPlaylistSimple[] instead of { results, … }. GenreTreeView no longer needs its .results / as CriteriaPlaylistSimple[] casts.
  • Tests:
    • The reference path makes exactly 1 fetch, to the tree URL. This guards against the fan-out coming back.
    • The me path still paginates with at most 4 requests in flight, and handles totalPages: 0 and null pages.
    • The GenreTreeView mocks now return arrays.
  • CHANGELOG: ### Breaking and ### Changed entries under [Unreleased]. This goes out as a major release (9.0.0).

Consumer follow-up

grow-the-music-tree-frontend GenreTreePage.tsx reads genrePlaylists?.results. When it bumps to 9.0.0 it must switch to genrePlaylists ?? []. hear-frontend doesn't read the hook's data, so it isn't affected.

Test plan

  • pnpm lint && pnpm build && pnpm test pass locally, including the coverage thresholds.
  • The prod endpoint GET /v1/genre-playlists/tree/?treeName=canonical returns 200, and its array items match CriteriaPlaylistSimpleSchema.

🤖 Generated with Claude Code

useListFullGenrePlaylists now hits genre-playlists/tree/ for the reference
scope and resolves to CriteriaPlaylistSimple[] for both scopes.

BREAKING CHANGE: useListFullGenrePlaylists data is an array, not a paginated envelope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 14:35
@Andreas-Garcia
Andreas-Garcia merged commit c7e2fad into develop Oct 3, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants