refactor(feed): drop feed-page redux slice; tab/filter via tan-query#14405
Merged
Conversation
|
The feed-page redux slice held only UI state (feedTab, feedFilter) plus
a followUsers saga that was a thin wrapper around socialActions.followUser.
Move both pieces of state into tan-query — useQuery as a shared subscribable
client store, localStorage for persistence — and rewire the 3 followUsers
callers to dispatch socialActions.followUser directly per user id.
- Add useFeedTab() / useFeedFilter() in common/api/tan-query/feed/
backed by useQuery + queryClient.setQueryData, persisting under
feed-page:tab / feed-page:filter localStorage keys.
- Thread LocalStorage through QueryContextType so tan-query hooks
can read/write storage (web + mobile providers wire the existing
per-platform LocalStorage instance).
- Migrate consumers: web desktop + mobile FeedPageContent, RN
FeedScreen, FeedFilterDrawer, FeedFilterButton.
- Rewire dispatch(feedPageActions.followUsers(ids)) → per-id
dispatch(usersSocialActions.followUser(id, FollowSource.EMPTY_FEED))
in FollowUsers, MobileWebEmptyFeed, SuggestedFollows.
- Delete pages/feed/{reducer,actions,selectors,types}.ts and the
feed-page saga; unregister from pages/index.ts, reducers.ts, and
web + mobile root sagas.
Persisted-state note: existing users with feedTab/feedFilter under the
old redux-persist 'feed-page' key will see the tab reset to For You
once on first load (new localStorage keys, no migration).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Prettier + import-order + consistent-type-imports fixes for files that landed on main between the original branch and this rebase. Not part of the feed-reducer refactor itself. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c55db72 to
4186375
Compare
lineupForRoute.js destructured selectors (getDiscoverFeedLineup, getHistoryTracksLineup, etc.) that the legacy-lineup migration in #14178 deleted, so every branch returned undefined — and nothing read the resulting context field anyway. The build only stayed green because feedPageSelectors still existed as an empty namespace; this PR's removal of the feed-page redux slice made rollup catch the missing export. - delete packages/web/src/store/lineup/lineupForRoute.js - remove the import + assignment in packages/web/src/store/storeContext.ts - drop the optional getLineupSelectorForRoute field (and now-unused Location/LineupState/Track/CommonState imports) from packages/common/src/store/storeContext.ts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14405.audius.workers.dev Unique preview for this PR (deployed from this branch). |
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
feed-pageredux slice held only UI state (feedTab,feedFilter) plus afollowUserssaga that was a thin wrapper aroundsocialActions.followUser. Both pieces are now in tan-query —useQueryas a shared subscribable client store,localStoragefor persistence.packages/common/src/api/tan-query/feed/useFeedPreferences.ts:useFeedTab()anduseFeedFilter(). They useuseQuery(staleTime: Infinity) so reads in any component share state, andqueryClient.setQueryData+localStorage.setItemon writes.LocalStoragethreaded throughQueryContextTypeso any tan-query hook can persist UI state (saga side already had it).followUserscallers (FollowUsers,MobileWebEmptyFeed,SuggestedFollows) now dispatchusersSocialActions.followUser(id, FollowSource.EMPTY_FEED)per id directly — the saga was just looping over that anyway.pages/feed/{reducer,actions,selectors,types}.ts,web/common/store/pages/feed/sagas.ts; unregistered frompages/index.ts,reducers.ts, web + mobile root sagas.Persisted-state note
Existing users with
feedTab/feedFilterunder the old redux-persistfeed-pagekey will see the tab reset to For You once on first load (new localStorage keys, no migration). The old reducer also did legacy-value coercion (FOLLOWING/UPLOADS_ONLY→CHRONOLOGICAL), which is no longer needed since the new keys start empty.Test plan
tscclean inpackages/webtscclean inpackages/mobiletscinpackages/common— no new errors (14 remaining are pre-existing SDK-shape mismatches unrelated to this change; pre-change main had 20 of the same family)🤖 Generated with Claude Code