fix: stop For You feed skeletons when query is disabled#14291
Merged
Conversation
|
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>
b5165ec to
47d99a6
Compare
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14291.audius.workers.dev Unique preview for this PR (deployed from this branch). |
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>
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.
Summary
currentUserId === null(or when callers passedenabled: false).useForYouFeedgateduseInfiniteQueryviaenabled, so the query stayed inisPending: trueforever with no data.TrackLineuprenders skeletons wheneverisPending && tiles.length === 0, so it spun indefinitely.isPending,isLoading, andisInitialLoadingtofalsein the hook's return shape. Consumers now fall through to the empty-state render path.Test plan
currentUserId === null) and visit the feed page — confirm the For You tab shows the empty state instead of perpetual skeletons.🤖 Generated with Claude Code