fix(explore): wrap trending genre pills and honor the genre from the URL#14526
Merged
Merged
Conversation
The Trending Genres pills on mobile were pinned to one line by a horizontal ScrollView, hiding all but the first few genres. Wrap them instead, matching the web section. Picking a second genre also kept showing the first one. TrendingPageContent read the genre from redux in preference to the URL, so arriving from Explore at /trending?genre=Rock with "Electronic" still in redux from an earlier visit discarded the param and rewrote the URL back to the stale genre. Treat the URL as the source of truth on mount and fall back to redux only when no genre param is present, so the last-used filter is still remembered when landing on a bare /trending. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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.
Description
Two fixes for the Trending Genres section on Explore.
1. Pills only rendered on a single line (mobile)
The mobile section wrapped its pills in a horizontal
ScrollView, so only the first few genres were visible and the rest required a sideways swipe that isn't discoverable. It now uses<Flex row wrap='wrap'>and flows onto multiple lines, matching the web section (which already wrapped).2. Picking a second genre kept showing the first
Clicking a pill navigates to
/trending?genre=<genre>, butTrendingPageContentpreferred the genre in redux over the one in the URL:Redux keeps
trendingGenreacross visits, so on the second pill click the branch above discarded the incoming?genre=and the follow-up sync effect rewrote the URL back to the stale genre. The lineup keys off redux, so it kept showing the old genre.The mount effect now treats the URL as the source of truth and falls back to redux only when there's no genre param — so landing on a bare
/trendingstill remembers the last filter. A ref guards the redux→URL sync effect from clobbering the incoming param on its first run, before redux catches up.Also switched the dispatch from
genre as anytotoTrendingGenreValue(genre), matching how the page's own genre filter normalizes values (it strips theElectronic -prefix and supports freeform genres).How Has This Been Tested?
Verified against the running web app (
npm run web, prod API), driving Explore → Trending in the browser.Reproduced the bug and confirmed the fix with the same sequence — load
/trending?genre=Electronic, go to Explore, then navigate to/trending?genre=Rock:trendingGenre?genre=ElectronicElectronic❌?genre=RockRock✅After the fix, the genre filter and lineup both show Rock.
Regressions checked in the browser:
/trendingwithRockin redux → still remembers Rock and writes?genre=Rockback to the URL.?genre=is removed and does not come back./trending?genre=Electronic→ loads Electronic.Typecheck and lint pass for
@audius/weband@audius/mobile.Note: the mobile layout change was not run in a simulator — it's a
ScrollView→Flex row wrap='wrap'swap, andwrapis an existingharmony-nativeFlexprop used elsewhere in the app, but it's worth a look on device.🤖 Generated with Claude Code