Web feed stops paginating after another tab refreshes the session ("session disposed")
Steps to Reproduce
- Log in on bsky.app in a desktop browser.
- Open the Following feed in tab A and scroll down a few pages.
- Open a second tab B on the same origin, e.g.
/notifications, and keep using it until the access token expires. Tab B then refreshes the session and broadcasts the new tokens to tab A. - Go back to tab A and scroll to the end of the feed.
- The feed stops loading and shows "There was an issue fetching posts. Tap here to try again." Tapping it has no visible effect. Only reloading the page or refreshing the feed from the top recovers.
Step 3 normally takes hours, because it depends on token expiry. For a deterministic repro, see "Deterministic reproduction" under Additional Information.
Attachments
No response
What platform(s) does this occur on?
Web (Desktop)
Device Info
No response
What version of the app are you using?
Build version: 1.134.0; Bundle info: 0f0f523 (prod); Bundle date: 26092602; Platform: web; Platform version: 0.0.0;
Additional Information
Root cause
The post feed stores its FeedAPI instance, including the lex Client it was created with, in the infinite query's page params:
post-feed.ts#L237-L243:getNextPageParamreturns{api: lastPage.api, cursor}.post-feed.ts#L197: every page after the first reuses thatapi, and with it the client captured when page 1 was loaded.
When another tab refreshes the session, this tab can't update its PasswordSession in place. It builds a new session bundle and disposes the old one:
session/index.tsx#L591: "PasswordSession cannot be patched in place. Rebuild from the tokens the leader already refreshed, then dispose the previous bundle."session/index.tsx#L710:disposeBundle(prevBundle)session-core.ts#L176: the disposed session's fetch throwsnew Error('session disposed').
The rest of the app switches to the new bundle, but the feed query still holds the old client. The next fetchNextPage therefore fails locally, without any network request:
XrpcFetchError: Unexpected fetchHandler() error: session disposed"Tap here to try again" calls fetchNextPage with the same page param, and so the same disposed client. It fails the same way within a millisecond, so it can never recover. A refetch from the top works because page 1 creates a new FeedAPI with the current client.
Notifications aren't affected. Their page param is just the cursor (notifications/feed.ts#L126), and each fetch uses the current client from useAppviewClient() (#L61).
Regression
This is a regression from #11343 ("[SDK] Rebuild the session core on PasswordSession", 2026-08-13). Before that, synced tokens were patched into the existing agent:
const agent = state.currentAgentState.agent as AtpAgent
agent.sessionManager.session = sessionAccountToSession(syncedAccount)The agent object stayed the same, so the one stored in the feed's page params (since #2034) remained valid. After #11343 the object is replaced and the old one disabled.
Captured in a real session
I subscribed to the React Query cache (read-only) in my own browser to log the post-feed query's state transitions. With a feed tab and a notifications tab open side by side:
22:15:50.837 post-feed "following" fetch (forward) pages: 7, last page has cursor: true
22:15:50.840 post-feed "following" error XrpcFetchError: Unexpected fetchHandler() error: session disposed
22:15:50.852 "There was an issue fetching posts" row rendered (no spinner, no network request)
22:16:50.312 tap on the row -> fetch -> same error, 0 new network requestsNo network request failed at any point. Every request in the session returned 200, which is why this never showed up server-side.
Deterministic reproduction
Two pages in one Playwright browser context, sharing storage and the broadcast channel:
Log in on page A, open the Following feed and load a few pages.
Open page B at
/notifications.On page B, answer exactly one XRPC request with an expired-token error.
PasswordSessionthen does a realrefreshSessionagainst the PDS and the new tokens get broadcast to page A.let faked = false await pageB.route('**/xrpc/**', route => { if (!faked && !route.request().url().includes('Session')) { faked = true return route.fulfill({status: 400, contentType: 'application/json', body: JSON.stringify({error: 'ExpiredToken', message: 'Token has expired'})}) } return route.continue() })Scroll page A to the end.
Results:
| With the faked expiry on page B | Control (no fake) | |
|---|---|---|
Page B refreshSession |
200 | – |
| New feed pages on page A afterwards | 0 | 22 |
| Error on page A | XrpcFetchError: … session disposed |
none |
| Error row on page A | shown | not shown |
I can share the full script if useful.
Possible fixes
- Keep only the cursor in the page param, as the notifications query does, and make sure fetches use the current client.
FollowingFeedAPIis stateless.HomeFeedAPIandMergeFeedAPIhold state, so they'd need their client swapped rather than recreated. - In
queryFn, detectpageParam.apihaving a different client from the current one and rebind or recreate it before fetching. - Include a session/bundle identity in the query key, so the feed restarts when the bundle is replaced. This is simpler but loses the scroll position.
Happy to open a PR once you've settled on an approach.
Source: bluesky-social/social-app