Skip to content

refactor(feed): drop feed-page redux slice; tab/filter via tan-query#14405

Merged
dylanjeffers merged 3 commits into
mainfrom
chore/drop-feed-reducer
May 26, 2026
Merged

refactor(feed): drop feed-page redux slice; tab/filter via tan-query#14405
dylanjeffers merged 3 commits into
mainfrom
chore/drop-feed-reducer

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • The feed-page redux slice held only UI state (feedTab, feedFilter) plus a followUsers saga that was a thin wrapper around socialActions.followUser. Both pieces are now in tan-query — useQuery as a shared subscribable client store, localStorage for persistence.
  • New hooks in packages/common/src/api/tan-query/feed/useFeedPreferences.ts: useFeedTab() and useFeedFilter(). They use useQuery (staleTime: Infinity) so reads in any component share state, and queryClient.setQueryData + localStorage.setItem on writes.
  • LocalStorage threaded through QueryContextType so any tan-query hook can persist UI state (saga side already had it).
  • The 3 followUsers callers (FollowUsers, MobileWebEmptyFeed, SuggestedFollows) now dispatch usersSocialActions.followUser(id, FollowSource.EMPTY_FEED) per id directly — the saga was just looping over that anyway.
  • Deleted: pages/feed/{reducer,actions,selectors,types}.ts, web/common/store/pages/feed/sagas.ts; unregistered from pages/index.ts, reducers.ts, 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). The old reducer also did legacy-value coercion (FOLLOWING / UPLOADS_ONLYCHRONOLOGICAL), which is no longer needed since the new keys start empty.

Test plan

  • tsc clean in packages/web
  • tsc clean in packages/mobile
  • tsc in packages/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)
  • Browser check pending — turbo + the SDK build chain blocked the local preview from coming up in this worktree; verifying the feed page in CI / on a follow-up. The change is a structural Redux→tan-query swap with the same persistence semantics, but a manual click-through (For You / Chronological switch, filter pills, empty-state "Follow Selected Artists") would still be good before merge.
  • Mobile RN: confirm FeedScreen tab switch, FeedFilterDrawer selection, FeedFilterButton active state, and SuggestedFollows "follow all" flow

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

⚠️ No Changeset found

Latest commit: 9504eec

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

dylanjeffers and others added 2 commits May 26, 2026 15:20
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>
@dylanjeffers dylanjeffers force-pushed the chore/drop-feed-reducer branch from c55db72 to 4186375 Compare May 26, 2026 22:23
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>
@dylanjeffers dylanjeffers merged commit 7c8fdaf into main May 26, 2026
9 checks passed
@dylanjeffers dylanjeffers deleted the chore/drop-feed-reducer branch May 26, 2026 22:40
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

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

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

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