Skip to content

iOS app: each notification tap loads a second copy of bb in a new WebView and never frees the old one #8246

Description

@salemsayed

Summary

In the iOS app (the WebView shell), tapping a bb push notification while the app's page is still alive loads a second copy of the web app in a new WebView instead of opening the thread in the page that is already running. The old WebView stays mounted underneath and is never released, so every tap costs a full page load (white screen, then skeleton) and one more WebContent process. Deep links and shares remount the WebView (also a full reload), and bb thread open stacks a WebView too, although the page already handles that signal itself. Expected: the live page opens the thread in place, and there is only ever one WebView.

Versions and environment

  • bb main at b0ddaad731565d7e4de68d824120d802fc78f7d5 (server, web app and apps/mobile JS), run from source with its own data dir, seeded with seed-perf-db (2 projects, 12 threads).
  • iOS Simulator, iPhone 17 Pro, iOS 26.5, Xcode 26.6 (macOS 26.5.2). App: Release simulator build of apps/mobile from the same commit (same package.json and lockfile), JS bundle from expo export:embed --platform ios --dev false --bytecode.
  • Server added in the app as a Direct URL server (http://127.0.0.1:41999). Push notifications turned on in the app's Settings → Notifications.
  • The JS involved (router.push of /webview) is the same on Android; I did not test Android.

Steps to reproduce

  1. Start bb from main with a fresh data dir and seed it: node --conditions=source --import tsx packages/scripts/src/commands/seed-perf-db.ts --data-dir <dir> --projects 2 --threads 12 --events 30000.
  2. Install the iOS app on a simulator, add the server, turn on push notifications, open any thread.
  3. Put the app in the background (open Settings).
  4. Send a notification for a different thread and tap its banner:
    xcrun simctl push <udid> app.getbb.mobile payload.json
    
    with payload.json:
    {"aps":{"alert":{"title":"Test bot","body":"done"}},"threadId":"thr_…","projectId":"proj_…","serverUrl":"http://127.0.0.1:41999"}
  5. Count the simulator's WebContent processes (ps -axo pid,ppid,command, children of the simulator's launchd_sim whose command contains com.apple.WebKit.WebContent).
  6. Repeat steps 3 to 5.

The same stacking happens with bb thread open <thread id> while the app is open. A deep link (xcrun simctl openurl <udid> bb://projects/<p>/threads/<t>) remounts the WebView instead of stacking.

Expected vs actual

Expected: the app returns to the live page and the page opens the notified thread; one WebView; no document load.

Actual (logging proxy between the simulator and the server; screenshots every ~150 ms after the tap):

tap 1: GET /projects/proj_n2izyamrfz/threads/thr_vesq97weyi  (Sec-Fetch-Dest: document)
       GET /ws                                                (a second WebSocket)
       WebContent processes: 1 -> 2   (RSS 512 MB, 506 MB)
tap 2: GET /projects/proj_n2izyamrfz/threads/thr_gmf86yn3mk  (document)
       WebContent processes: 2 -> 3   (RSS 512 MB, 493 MB, 490 MB)

On screen: a white page from about 0.5 s to 0.8 s after the tap, then the thread skeleton, then the thread at 1.5 to 1.8 s. The page underneath also comes back to life: it refetches its own timeline and reconnects its own WebSocket on every resume.

Evidence

  • Notification taps push a new screen: PushNotificationsHost.tsx#L82-L95. The webview screen has no getId/dangerouslySingular (RootNavigator.tsx#L80-L83), so router.push always adds another ProfileWebViewScreen with its own WebView, and the native stack keeps the one below mounted (it has gestureEnabled: false, so it is never popped).
  • bb thread open does the same from ThreadOpenSignalHandler.tsx#L16, while the page inside the WebView already handles the same signal in AppLayout.tsx#L518 (the proxy log shows the live page fetching the new thread's timeline 0.4 s before the shell's second WebView requests the document).
  • Deep links and shares change requestedPath, which is part of the WebView key (ProfileWebViewScreen.tsx#L92-L95, #L356), so each one remounts the WebView.
  • Real-device context: traces from one iPhone running the TestFlight app over a day showed full reloads only after 10+ minutes in the background (none in 86 returns under 10 minutes, 16 in 31 longer ones). That pattern is iOS reclaiming the WebContent process, which the shell already recovers from with onContentProcessDidTerminate (#L452) and which bb cannot prevent. Every extra stacked WebView adds about half a gigabyte (simulator RSS) that makes those kills more likely.

What I ruled out

  • Not bb connect session renewal (shouldReloadForSession): this repro uses a Direct URL server, and connect sessions last seven days.
  • Not the app-update or stale-chunk reloads: the server revision did not change during the runs.
  • A cold start from a notification (app not running) creates one WebView; the stacking needs a live page.
  • Searched open and closed issues for notification, WebView, reload and deep link reports; none match.

Suggested priority and effort

Every mobile user who taps notifications hits it, on every tap. Workaround: force-quit the app. Nothing is lost. A fix prototype (single webview screen plus a navigate bridge event the page acknowledges, with a reload fallback for older servers) is on https://github.com/salemsayed/bb/tree/fix/mobile-shell-open-in-place.

AGENT GENERATED

Activity

  1. added theissue type on Nov 26, 2026
  2. added
    mobile
    remote
    partial-repro
    on Nov 26, 2026
  3. bb-slop-cop commented on Nov 26, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification applied: Bug · Priority Medium · Effort Medium · mobile, remote, perf.
    • Reproduction and root-cause report: PARTIALLY REPRODUCED, with high confidence in the JavaScript navigation cause. Reproduction label: partial-repro.
    • Root cause: notification responses push WebView routes without stable screen identity. The real handler and Expo stack router retain 1 → 2 → 3 routes after two responses, including the original. Source also shows the requested path participates in the WebView key, causing remounts when it changes.
    • Verification: the focused single-route regression fails as expected in two clean trusted-main worktrees; 47 existing relevant tests pass. Native WebContent counts, RSS, and visual timing remain unverified on this Linux host; the report includes the complete test and limitations.
    • No new PR: open Open notification taps and deep links in the live mobile page #8247 already links and closes this issue, so another fix PR would duplicate existing work. Its diff received a static review only; no PR code was run.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mobilepartial-reproperfremote

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions