fix(mobile): queue the track-page lineup from the hero Play button#14447
Merged
Conversation
When you press the big Play button on a mobile track-detail screen, it
should hand the related-tracks lineup that the same screen already
fetches (Remixes / More By <artist> / You Might Also Like) to the
player as the queue — so playback flows past the hero track into those
related sections, the same way pressing play on a tile in any other
lineup-driven screen (feed, profile, library) does.
Before this fix, `TrackScreenDetailsTile`'s play handler dispatched
`playFrom({ tracks: [{ trackId, source: 'TRACK_TRACKS' }], startIndex: 0,
querySource: null })` — a queue of exactly one item — so playback
stopped at the end of the hero track.
Wire the hero button into the same `useTrackPageLineup` hook
`TrackScreenLineup` uses to render the sections below the track:
- Subscribe with `enabled: !!isReachable` to mirror the visibility gate
on `TrackScreenLineup` in `TrackScreen.tsx`. tanquery shares the cache
by query key with the existing subscription in `TrackScreenLineup`,
so this does not double-fetch.
- In the `play` callback, build the queue as
`[{ trackId, source: 'TRACK_TRACKS' }, ...rest.map(id => ({ trackId: id,
source: 'TRACK_PAGE_MORE_BY' }))]`. The hero keeps the legacy
`'TRACK_TRACKS'` source so its uid
(`makeStableUid(Kind.TRACKS, track_id, 'TRACK_TRACKS')` from
`TrackScreen.tsx`) still matches. The remainder uses
`'TRACK_PAGE_MORE_BY'` so when auto-advance reaches a related track,
the matching tile in `TrackScreenLineup` (which also renders with
`source='TRACK_PAGE_MORE_BY'`) highlights as playing.
- Pass `querySource: { queryKey: [...getTrackPageLineupQueryKey(trackId)] }`
to match what `TrackScreenLineup` already hands `TrackLineup`, so the
playback saga can paginate the lineup near the queue's end.
- Skip the lineup queue when the Preview button is pressed
(`isPreview === true`) — preview is intentionally a single-track,
no-auto-advance gesture.
- Fall back to the original single-track queue when the lineup isn't
loaded yet (offline, or a fast tap before the hook resolves) — so
the worst case matches today's behavior.
Files:
- packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 (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.
The bug
When you press the big Play button at the top of a track-detail screen on mobile, it should queue up the related-tracks lineup that the same screen renders below — Remixes / More By
<artist>/ You Might Also Like — so playback continues past the hero track. Today it doesn't: the queue is exactly one item and playback stops at the end of the hero.Every other lineup-driven screen on mobile (feed, profile tracks/reposts, library) does this correctly because its play interactions go through
TrackLineup, which builds a multi-trackplayFromqueue with aquerySource. The track screen's hero Play button bypassesTrackLineupentirely and dispatches its ownplayFrom.Before
packages/mobile/src/screens/track-screen/TrackScreenDetailsTile.tsx:After
Subscribe to the same
useTrackPageLineuphook thatTrackScreenLineupalready uses to render the sections below the track, and build the queue fromtrackIds:Why these specific source strings
'TRACK_TRACKS'so its uid (makeStableUid(Kind.TRACKS, track_id, 'TRACK_TRACKS')fromTrackScreen.tsx) still matches the queue entry, and the hero's own play-button state continues to derive correctly from the playback selectors.'TRACK_PAGE_MORE_BY'because that is the sourceTrackScreenLineupalready handsTrackLineupfor all four sections (renderRemixParentSection,renderRemixesSection,renderMoreBySection,renderRecommendedSection). When auto-advance reaches a related track, the corresponding tile down the page highlights as currently-playing.Why
useTrackPageLineuphere doesn't double-fetchtanquery shares query data by key.
TrackScreenLineupalready subscribes viauseTrackPageLineup({ trackId }); adding a second subscription inTrackScreenDetailsTilefor the sametrackIdhits the same cache entry. Theenabled: !!isReachablematches the truthiness check{isReachable ? <TrackScreenLineup>...inTrackScreen.tsxso we don't fire the network fetch when offline.Edge cases
isPreview === true)lineupTrackIds.length <= 1→ falls back to single-track queue (today's behavior).enabled: !!isReachablekeeps the hook from firing →lineupTrackIdsstays empty → single-track queue (today's behavior). The lineup section also doesn't render below in this state, so there's nothing to queue anyway.lineupTrackIds[0]somehow isn't the herouseTrackPageLineupalways pushes the hero at index 0 and setsindices.mainTrackIndex = 0— but the guard costs nothing.Verification
tsc --noEmitclean inpackages/mobile.isReachable).🤖 Generated with Claude Code