#11795·social-app

Web feed stops paginating after another tab refreshes the session ("session disposed")

Author: n0vedadCreated Sep 26, 2026Updated Sep 26, 2026
Labelsbug

Steps to Reproduce

  1. Log in on bsky.app in a desktop browser.
  2. Open the Following feed in tab A and scroll down a few pages.
  3. 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.
  4. Go back to tab A and scroll to the end of the feed.
  5. 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: getNextPageParam returns {api: lastPage.api, cursor}.
  • post-feed.ts#L197: every page after the first reuses that api, 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:

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:

javascript
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 requests

No 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:

  1. Log in on page A, open the Following feed and load a few pages.

  2. Open page B at /notifications.

  3. On page B, answer exactly one XRPC request with an expired-token error. PasswordSession then does a real refreshSession against the PDS and the new tokens get broadcast to page A.

    javascript
    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()
    })
  4. 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

  1. Keep only the cursor in the page param, as the notifications query does, and make sure fetches use the current client. FollowingFeedAPI is stateless. HomeFeedAPI and MergeFeedAPI hold state, so they'd need their client swapped rather than recreated.
  2. In queryFn, detect pageParam.api having a different client from the current one and rebind or recreate it before fetching.
  3. 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