Skip to content

fix: stop For You feed skeletons when query is disabled#14291

Merged
dylanjeffers merged 1 commit into
mainfrom
claude/happy-moore-cfc777
May 12, 2026
Merged

fix: stop For You feed skeletons when query is disabled#14291
dylanjeffers merged 1 commit into
mainfrom
claude/happy-moore-cfc777

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • The For You feed tab was rendering infinite skeleton placeholders for users with currentUserId === null (or when callers passed enabled: false).
  • Root cause: useForYouFeed gated useInfiniteQuery via enabled, so the query stayed in isPending: true forever with no data. TrackLineup renders skeletons whenever isPending && tiles.length === 0, so it spun indefinitely.
  • Fix: when the query is disabled, override isPending, isLoading, and isInitialLoading to false in the hook's return shape. Consumers now fall through to the empty-state render path.

Test plan

  • Sign out (or simulate currentUserId === null) and visit the feed page — confirm the For You tab shows the empty state instead of perpetual skeletons.
  • Sign in and confirm the For You feed still loads and shows skeletons during the initial fetch, then content.
  • Verify the Following tab behavior is unchanged.

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

⚠️ No Changeset found

Latest commit: 47d99a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

When currentUserId is null or options.enabled is false, the underlying
useInfiniteQuery stays in isPending: true with no data, which causes
TrackLineup to render skeletons indefinitely. Override the pending/loading
flags from the hook so consumers fall through to the empty state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers force-pushed the claude/happy-moore-cfc777 branch from b5165ec to 47d99a6 Compare May 12, 2026 17:01
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14291.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers dylanjeffers merged commit 74e248b into main May 12, 2026
14 checks passed
@dylanjeffers dylanjeffers deleted the claude/happy-moore-cfc777 branch May 12, 2026 17:37
dylanjeffers added a commit that referenced this pull request May 13, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant