feat(feed): surface recommended playlists inside the For You feed#14411
feat(feed): surface recommended playlists inside the For You feed#14411dylanjeffers wants to merge 2 commits into
Conversation
The For You feed (web + mobile) currently renders tracks only — a
documented limitation introduced when the lineup migrated to
TanStack Query. Collections never made it back. This adds them.
Approach: TrackLineup already exposes a `delineatorMap` extension
point (Record<index, ReactElement>). Feeding it a single
"Playlists for you" strip at position 5 inlines a horizontal scroll
of recommended playlists into the lineup without rewriting the
lineup itself or touching playback semantics. When the proper
inline-mixed lineup ships (Track + Collection tiles ordered by the
backend's For You scoring), this strip can go away.
Data source: `useTrendingPlaylists` (new), mirroring
`useTrendingAlbums` with `type: 'playlist'` against
`sdk.playlists.getTrendingPlaylists`. There is no per-user
recommended-collections endpoint in either the Go API
(packages/identity aside, only `v1_users_recommended_tracks.go`
exists for personalization) or discovery-provider, so trending
playlists is the closest stable signal available right now.
- packages/common/src/api/tan-query/collection/useTrendingPlaylists.ts: new hook
- packages/common/src/api/tan-query/queryKeys.ts: trendingPlaylists key
- packages/common/src/api/index.ts: re-export
- packages/web/src/pages/feed-page/components/ForYouCollectionsRow.tsx: new strip (shared by desktop + mobile-web)
- packages/web/src/pages/feed-page/components/{desktop,mobile}/FeedPageContent.tsx: pass delineatorMap on For You
- packages/mobile/src/screens/feed-screen/ForYouCollectionsRow.tsx: native equivalent using CollectionList horizontal
- packages/mobile/src/screens/feed-screen/FeedScreen.tsx: pass delineatorMap on For You
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
End-to-end validation against prod (2026-05-27) showed /v1/playlists/trending returns an empty data array whenever user_id is set — confirmed for both type=playlist and type=album across week/month/year/allTime. Without user_id the same endpoint returns the expected 10 playlists. The hook was passing OptionalId.parse(currentUserId), so the "Playlists for you" strip would silently render nothing for every logged-in user (i.e. the only audience the For You feed targets). Drop user_id from the call. has_current_user_reposted / has_current_user_saved on each playlist payload will be false under this code path until the backend regression is fixed — acceptable for the discovery strip, where the cards link out and the badges aren't currently shown on the card surface. Same bug affects the pre-existing useTrendingAlbums hook (which this hook mirrored). Filed separately — see PR description. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
End-to-end validation against prod (2026-05-27) — partial issue found and fixed inline, plus one backend regression flagged for follow-up. What I checked
The bug I introducedThe original hook mirrored `useTrendingAlbums` exactly, including `userId: OptionalId.parse(currentUserId)`. Because the trending-playlists endpoint returns `[]` for any `user_id`, the "Playlists for you" strip would silently never render for a logged-in user — the only audience For You targets. Fix in this push (`6b5b314968`)Drop `user_id` from the hook's SDK call. Without it the endpoint returns 10 playlists as expected. The trade-off is that `has_current_user_reposted` / `has_current_user_saved` flags come back as `false` — fine for the discovery strip where the cards just link out and don't show those badges. Pre-existing bug surfaced`useTrendingAlbums` (the hook this one mirrored, used on Explore) has the same problem: it also passes `user_id` and so would also return 0 albums when logged in. I haven't touched that here — separate scope, separate PR. 🤖 Generated with Claude Code |
Summary
The For You feed (web + mobile) currently renders tracks only — a documented limitation introduced when the lineup migrated to TanStack Query. This brings collections back, scoped to a single "Playlists for you" strip inlined into the lineup.
Approach
`TrackLineup` (web + mobile) already accepts a `delineatorMap: Record<index, ReactElement>` extension point. Feeding it a strip at position 5 surfaces recommended playlists inline without rewriting the lineup or touching playback semantics:
Scope note
When the proper inline-mixed lineup ships — i.e. `useForYouFeed` returning mixed track + collection IDs and `TrackLineup` rendering `CollectionTile` for the collection branch — this strip can go away. That's a larger change (lineup + playback queue semantics) deferred to a follow-up.
Test plan
🤖 Generated with Claude Code