Commit 9ca80fe
refactor(for-you): back feed's For You tab with /recommended-tracks (#14301)
## Summary
The Feed page's **For You** tab hit a dedicated
`/v1/users/{id}/feed/for-you` endpoint with its own custom server-side
ranker. That endpoint had:
- An auth gate that broke the web RC (fixed in api#804)
- A 60+s SQL plan for power users (partially mitigated in api#805/#806,
but `similar_artists` self-join still timed out — see [EXPLAIN ANALYZE
writeup])
Meanwhile, the **Explore page's For You section** already exists, works
fine, and is powered by `/v1/users/{id}/recommended-tracks` (via
`useRecommendedTracks` → `sdk.users.getUserRecommendedTracks`). Same
shape: ranked track list for the signed-in user.
This PR consolidates: rewrite `useForYouFeed`'s queryFn to call the same
SDK method the Explore section uses. The custom `/feed/for-you` endpoint
is being deleted from the API in a companion PR.
## What changed
- `packages/common/src/api/tan-query/lineups/useForYouFeed.ts`
- `sdk.users.getUserForYouFeed(...)` →
`sdk.users.getUserRecommendedTracks(... timeRange: Week)`
- Updated docstring to point at the new endpoint
## What stayed the same (intentionally — so consumers don't touch)
- Exported symbols: `useForYouFeed`, `FOR_YOU_INITIAL_PAGE_SIZE`,
`FOR_YOU_LOAD_MORE_PAGE_SIZE`, `getForYouFeedQueryKey`
- Return shape (`trackIds`, `isPending`, `isLoading`, `isFetching`,
`isSuccess`, `isError`, `isInitialLoading`, `hasNextPage`,
`fetchNextPage`, `loadNextPage`, `refetch`, `queryKey`)
- Page sizes (10/10)
- The `isDisabled` empty-state behavior added in #14290/#14291
Verified consumers — none needed changes:
-
`packages/web/src/pages/feed-page/components/desktop/FeedPageContent.tsx`
-
`packages/web/src/pages/feed-page/components/mobile/FeedPageContent.tsx`
- `packages/mobile/src/screens/feed-screen/FeedScreen.tsx`
## Test plan
- ✅ Typecheck clean (`tsc --noEmit -p packages/common`)
- ✅ Lint clean
- After deploy on the web RC (`release-candidate.audius.co`):
- Signed in, open Feed → For You tab → should show recommended tracks
(same content as Explore's For You section)
- Network:
`/v1/users/{id}/recommended-tracks?time_range=week&limit=10&offset=0&user_id={id}`
→ 200 with track data
- No more calls to `/v1/users/{id}/feed/for-you`
- Following tab still works (regression check)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6a312f0 commit 9ca80fe
1 file changed
Lines changed: 9 additions & 6 deletions
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
0 commit comments