feat(genres): dynamic trending genre filter + Trending Genres explore section#14497
Merged
Conversation
…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>
|
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>
…-genre-filter # Conflicts: # packages/common/src/api/index.ts # packages/common/src/api/tan-query/queryKeys.ts # packages/common/src/utils/genres.ts
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14497.audius.workers.dev Unique preview for this PR (deployed from this branch). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)/v1/genres/popularstaleTime~15 min to match the backend cache TTLcountand the long-tail stays searchableTrending genre filter — top genres by default + search for long-tail
TrendingPageContent.tsx):FilterButtonoptions come from the popular genres, withshowFilterInputenabled so long-tail genres are searchableGenreSelectionListgains atopGenresprop): shows the ranked genres by default, searches the full setTrendingFilterDrawer.tsx): same top-by-default + search-the-long-tail behaviorFreeform-safe selection — new
toTrendingGenreValuehelper accepts community/freeform genres (unliketoTrendingGenre, which dropped any value outside the staticGENRESlist, 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
GenresApi,PopularGenre,PopularGenresResponse) and wiring are included as a dependency.isValidGenreonly validates the static list) — in-session selection works; URL restore for freeform genres is left as a follow-up.Test plan
tscpasses forcommon,web,mobileeslintpasses for all touched filesgenres.test.tsunit tests pass