fix(mobile): rich CollectionTile in lineups (large artwork + track list + duration)#14428
Merged
Conversation
…st + duration) In the feed lineup, mobile's CollectionTile rendered as a compact row (small 72×72 thumbnail beside title/artist, no track list, no duration) — missing the rich card layout the web's mobile view shows for the same data (large artwork, "PLAYLIST"/"ALBUM" label, title, duration, 5-row numbered track list with "by <artist>", "+N Tracks" overflow). Two root causes, both fixed: 1. **No UID was passed in**. After #14411 wired CollectionTile into TrackLineup, the entry was constructed with only the collection ID. `useEnhancedCollectionTracks` requires a UID to derive per-row track UIDs; called with `''`, it returns `[]`. With zero tracks, the sum `duration` is `0` (so the formatted text was hidden) and the `CollectionTileTrackList` body rendered empty. - TrackLineup: add a `Kind.COLLECTIONS` `uidFor` and include `uid: collectionUidFor(item.id)` on `CollectionEntry`; pass `uid` to `<CollectionTile>`. 2. **Wrong layout for the lineup context.** `LineupTileMetadata` is a row-layout (image beside title) with `LineupTileArt` hardcoded at 72×72, and `LineupTileTopRight` hardcodes `isCollection={false}` (so duration is formatted with the wrong shape). Bypassed it for the collection variant and inlined a card header: full-width square 480×480 `CollectionImage`, then `PLAYLIST`/`ALBUM` label, title row with duration on the right (`formatLineupTileDuration(_, false, true)` → "15m 32s"), then the artist link. Stats / track list / action buttons unchanged. 3. **Skeleton during fetch.** Pass `isLoading={tracks.length === 0 && expectedTrackCount > 0}` so `CollectionTileTrackList` renders skeleton rows while tracks are loading, instead of an empty block that looks like the old compact tile. Chat unfurled collections and explore-screen carousel both already pass `collection` and `tracks` (or use sufficiently wide layouts), so the richer card sits inside their existing constraints fine. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
…tracks
Previous commit on this branch added a UID indirection to fetch the
collection's tracks via the existing `useEnhancedCollectionTracks(uid)`
hook. That was the wrong shape: web's mobile CollectionTile uses
`useOrderedCollectionTracks(collection)` driven directly by the
collection ID, with no UID anywhere in the read path. Mirror that exactly.
- `CollectionTile.tsx`: drop the `uid` prop / destructure. Drop the
custom `useCollection(id, {select})` (web reads the full collection).
Replace `useEnhancedCollectionTracks(uid ?? '')` with
`useOrderedCollectionTracks(cachedCollection)`. Update `handlePress` to
pass only `id` to `togglePlay` — there is no per-row UID to forward
(the new playback slice in TrackLineup ignores `uid` anyway and queues
by `id`).
- `CollectionTileTrackList.tsx`: switch the track type from
`LineupTrack` to `CollectionTrack` (TrackMetadata). Mirror web's
`TrackItem` exactly: fetch the artist name per row via
`useUser(track?.owner_id, { select: u => u?.name })` instead of
reading the (no-longer-present) `track.user?.name` join.
- `TrackLineup.tsx`: revert the previous commit's `collectionUidFor`
and the `uid` field on `CollectionEntry` / on the `<CollectionTile>`
call site. Pure ID flow now.
Same visual outcome as before (large 480 artwork, label, title +
duration row, artist link, 5-row track list with "by <artist>", "+N
Tracks" overflow, skeleton during fetch), but the data path now
matches web exactly. No UIDs anywhere in CollectionTile.
🤖 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.
Mobile collection tiles in the feed lineup were rendering as a compact row (small 72×72 thumbnail beside title/artist, no track list, no duration) — the wrong shape compared to web's mobile view, which shows a card layout (large artwork, label, title, duration, 5-row numbered track list with "by ", "+N Tracks" overflow).
How web does it (the path we now mirror)
packages/web/src/components/track/mobile/CollectionTile.tsx:And the per-row
TrackItemfetches its artist name separately:No UIDs anywhere —
useOrderedCollectionTrackstakes the collection and pulls tracks viauseTracks(collection.trackIds)internally; it returns plainCollectionTrack[](akaTrackMetadata[]), nouserjoin. Mobile now does the same.Root cause
After #14411 wired the new collection branch into the mobile
TrackLineup, the existinguseEnhancedCollectionTracks(uid)hook returned[]because the lineup didn't supply a UID. That lefttracks.length === 0, so the sumdurationwas0(hiding behind aduration > 0guard) andCollectionTileTrackListrendered an empty body. Compounded byLineupTileMetadatabeing a row-layout with a hardcoded 72×72LineupTileArt.Changes
packages/mobile/src/components/lineup-tile/CollectionTile.tsxuidprop / destructure entirely.useCollection(id, { select })(web reads the full collection — mirror).useEnhancedCollectionTracks(uid ?? '')withuseOrderedCollectionTracks(cachedCollection).LineupTileMetadatafor the collection variant; inline a card-style header: full-width squareCollectionImageatSquareSizes.SIZE_480_BY_480, thenPLAYLIST/ALBUMlabel, title row with duration on the right viaformatLineupTileDuration(_, false, true)(renders "15m 32s"), artist link.isLoading={tracks.length === 0 && trackCount > 0}soCollectionTileTrackListrenders skeleton rows during the fetch.handlePresspasses onlyidtotogglePlay— the new playback slice'stogglePlayalready ignoresuidand queues byid.packages/mobile/src/components/lineup-tile/CollectionTileTrackList.tsxLineupTracktoCollectionTrack(TrackMetadata).TrackItemexactly: fetch the artist name per row viauseUser(track?.owner_id, { select: u => u?.name })and render\by ${trackOwnerName ?? ''}`instead of reading the (no-longer-present)track.user?.name` join.packages/mobile/src/components/lineup/TrackLineup.tsxcollectionUidForcallback, theuidfield onCollectionEntry, and theuidprop on<CollectionTile>.Non-lineup surfaces
The two other
CollectionTilecallers — chat-unfurledChatMessagePlaylist.tsxandCollectionLineupCarousel— both passcollectionandtracksexplicitly or sit inside 343-wide columns. The card layout fits in both contexts; nothing else changed.Verification
tsc --noEmitclean inpackages/mobileandpackages/commonPLAYLISTlabel, title, duration, numbered track rows (up to 5) with "by ",+N Tracksoverflow, action buttons. Track-tile entries unchanged.🤖 Generated with Claude Code