Skip to content

feat(genres): dynamic trending genre filter + Trending Genres explore section#14497

Merged
dylanjeffers merged 3 commits into
mainfrom
feat/dynamic-trending-genre-filter
Jun 18, 2026
Merged

feat(genres): dynamic trending genre filter + Trending Genres explore section#14497
dylanjeffers merged 3 commits into
mainfrom
feat/dynamic-trending-genre-filter

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

What

Replaces the hardcoded trending genre list with the top genres ranked by recent activity, fetched dynamically from /v1/genres/popular. This is needed now that freeform genres are supported and a static list is no longer sufficient.

Changes

New hook — usePopularGenres (packages/common/src/api/tan-query/search/usePopularGenres.ts)

  • Fetches the top 25 genres from /v1/genres/popular
  • staleTime ~15 min to match the backend cache TTL
  • Merges the ranked genres with the static list (deduped, popular-first) so ranked genres carry a count and the long-tail stays searchable

Trending genre filter — top genres by default + search for long-tail

  • Web desktop (TrendingPageContent.tsx): FilterButton options come from the popular genres, with showFilterInput enabled so long-tail genres are searchable
  • Web mobile genre page (GenreSelectionList gains a topGenres prop): shows the ranked genres by default, searches the full set
  • Native mobile drawer (TrendingFilterDrawer.tsx): same top-by-default + search-the-long-tail behavior

Freeform-safe selection — new toTrendingGenreValue helper accepts community/freeform genres (unlike toTrendingGenre, which dropped any value outside the static GENRES list, nullifying freeform selections). Builds on the freeform chip fix from #14489 without regressing it.

Explore "Trending Genres" section (web + mobile) and edit-track genre suggestions are powered by the same hook.

Notes / scope

  • SDK genre endpoint (GenresApi, PopularGenre, PopularGenresResponse) and wiring are included as a dependency.
  • Unrelated SDK regen drift (Notification/Event/etc.) and the comment-drawer work on the original branch were intentionally excluded to keep this PR focused.
  • Sharing a freeform genre via the trending URL param still won't restore on reload (isValidGenre only validates the static list) — in-session selection works; URL restore for freeform genres is left as a follow-up.

Test plan

  • tsc passes for common, web, mobile
  • eslint passes for all touched files
  • genres.test.ts unit tests pass

…es API

Replace the hardcoded trending genre list with the top genres ranked by
recent activity, fetched from /v1/genres/popular. Adds a `usePopularGenres`
tan-query hook (top 25, ~15min staleTime to match the backend cache TTL)
that merges the ranked genres with the static list, deduped and popular-first.

Trending genre filter (web desktop FilterButton, web mobile genre page, and
the native mobile drawer) now shows the top ranked genres by default with a
search field that reveals the long-tail static genres. Freeform/community
genres are now selectable via `toTrendingGenreValue`, which (unlike
`toTrendingGenre`) does not drop values outside the static GENRES list.

Also surfaces the ranked genres in the Explore "Trending Genres" section
(web + mobile) and powers the edit-track genre suggestions, all from the same
hook.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8c7f533

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

isValidGenre only validated against the static GENRES list, so a freeform
genre in the URL (e.g. /trending?genre=Hyper+Pop) was dropped on load.
Make it permissive — accept any non-empty value that isn't the ALL_GENRES
sentinel — since canonical validation is now server-side via normalization.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers changed the title feat(genres): dynamic genre filter on trending page from popular genres API feat(genres): dynamic trending genre filter + Trending Genres explore section Jun 18, 2026
…-genre-filter

# Conflicts:
#	packages/common/src/api/index.ts
#	packages/common/src/api/tan-query/queryKeys.ts
#	packages/common/src/utils/genres.ts
@github-actions

Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14497.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers dylanjeffers merged commit 2221aab into main Jun 18, 2026
13 checks passed
@dylanjeffers dylanjeffers deleted the feat/dynamic-trending-genre-filter branch June 18, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant