Skip to content

Open notification taps and deep links in the live mobile page - #8247

Merged
ymichael merged 1 commit into
get-bb:mainfrom
salemsayed:fix/mobile-shell-open-in-place
Nov 30, 2026
Merged

ymichael merged 1 commit into
get-bb:mainfrom
salemsayed:fix/mobile-shell-open-in-place

Conversation

@salemsayed

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

The mobile shell opened every external "open this thread" request by routing to /webview with new params. A push notification tap used router.push, and the webview screen had no singular id, so each tap mounted another ProfileWebViewScreen with its own WebView on top of the live one. The new WebView loaded the whole web app again (white page, skeleton, then the thread) and the old one stayed mounted underneath with its own WebContent process and WebSocket. ThreadOpenSignalHandler did the same for bb thread open, although the page already handles that signal itself. Deep links and shares changed requestedPath, which was part of the WebView key, so they remounted the WebView. Issue: #8246.

What changed

  • packages/mobile-bridge: a shell-to-page navigate event (app-relative paths only) and a page-to-shell capabilities message. Unknown capabilities are dropped, and older shells already drop the unknown message type.
  • apps/app: NativeShellNavigator takes navigate events through the app's router and reports the navigate capability once per page load. It does nothing outside the shell.
  • apps/mobile:
    • The webview stack screen is singular (dangerouslySingular), so a push to /webview reuses the mounted screen instead of stacking another WebView.
    • ProfileWebViewScreen consumes profileId/path params as one open request and clears them, so the same notification tapped again still opens. requestedPath is no longer part of the WebView key. When the page is loaded and has reported navigate, the shell sends the event and keeps the WebView. Otherwise (a page from an older server, a page still loading or failed, or a server switch) it loads the path in the same WebView, as before.
    • ThreadOpenSignalHandler is removed; the page's own thread-open handler opens the thread.
  • No change to MOBILE_BRIDGE_VERSION: the additions are optional on both sides.

How you verified

iOS Simulator (iPhone 17 Pro, iOS 26.5), Release simulator build of apps/mobile, JS bundles from expo export:embed --bytecode of main and of this branch, against a source build of bb with a seeded data dir, Direct URL server, push notifications on. A logging proxy recorded document loads, and screenshots were taken every ~150 ms after each tap.

Notification tap with the page alive main this branch
Document load of the thread yes no
WebContent processes after 2 taps 3 (~0.5 GB RSS each) 1
Thread on screen after the tap 1.5 to 1.8 s, white page from ~0.5 s 0.5 to 0.6 s (one run 1.1 s), no white page

Also on this branch:

  • bb thread open and a bb://projects/<p>/threads/<t> deep link open the thread in place: no document load, still one WebView.
  • Tapping a notification for the same thread again after moving to another thread opens it again in place.
  • Older page (served apps/app/dist from main) with this shell: the tap loads the thread in the same WebView, one WebContent process.
  • Cold start from a notification: one WebView, the notified thread loads directly.
  • WebContent process killed in the background (kill -9, as iOS does under memory pressure): the shell still reloads on resume, at the thread last opened in place.

Unit tests: shell-state.test.ts (resolveShellOpen, resolveShellLoadPath), messages.test.ts (capabilities parsing), native-shell.test.ts (NativeShellNavigator navigates on the event, reports the capability, ignores //host and absolute URLs, stays silent outside the shell).

pnpm exec turbo run lint typecheck test --filter=@bb/mobile --filter=@bb/mobile-bridge --filter=@bb/app: lint and typecheck pass in all three packages; @bb/mobile and @bb/mobile-bridge tests pass; @bb/app has 7,485 passing and 2 failing tests, both in ThreadDetailPromptArea.test.tsx ("keeps a delayed bottom upload owned by the bottom draft", "dismisses a missing queued message but keeps a stale edit recoverable"). The same two fail on main at b0ddaad73 with this change reverted.

Not tested: Android, and switching servers from a notification (no second server in this setup; that path keeps the existing reload behaviour).

Fixes #8246

AGENT GENERATED

Tapping a push notification while the mobile shell's page was alive
pushed a second /webview screen. Each tap loaded a fresh copy of the
web app in a new WebView and kept the old one alive underneath, so
every tap cost a full page load and another WebContent process. Deep
links and shares remounted the WebView, and `bb thread open` stacked a
WebView even though the page already handles that signal itself.

The /webview screen is now single, and the shell hands an open request
to the live page with a new `navigate` bridge event once the page
reports it can take one. Pages from older servers, pages still loading
and server switches keep the reload path, in the same WebView.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexburlis added a commit to alexburlis/omnyo that referenced this pull request Nov 26, 2026
Record the upstream PRs, revisions, contributors, and Omnyo integration
commits for merge d2a24ac in docs/upstream-credits.md.

Original-PR: get-bb/bb#7663
Original-Commit: get-bb/bb@1737a03
Original-Author: rufi
Original-PR: get-bb/bb#8055
Original-Commit: get-bb/bb@651ae20
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8075
Original-Commit: get-bb/bb@511e1ed
Original-Author: Jake Lancaster
Original-Co-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8096
Original-Commit: get-bb/bb@775090b
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8145
Original-Commit: get-bb/bb@8de6711
Original-Commit: get-bb/bb@0d3db49
Original-Commit: get-bb/bb@92d3a76
Original-Commit: get-bb/bb@6705422
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8171
Original-Commit: get-bb/bb@b56ed04
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8238
Original-Commit: get-bb/bb@2a9a142
Original-Author: SawyerHood
Original-PR: get-bb/bb#8247
Original-Commit: get-bb/bb@ba4ae22
Original-Author: Salem
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8259
Original-Commit: get-bb/bb@96f40a9
Original-Author: SawyerHood
Original-PR: get-bb/bb#8263
Original-Commit: get-bb/bb@141e40a
Original-Author: mk
Original-PR: get-bb/bb#8266
Original-Commit: get-bb/bb@84e20e9
Original-Author: ILIA GOLUBEV
@ymichael
ymichael merged commit 4408565 into get-bb:main Nov 30, 2026
36 checks passed
scowalt pushed a commit to scowalt/bb that referenced this pull request Dec 1, 2026
…#8247)

## Human comments

## What was wrong

The mobile shell opened every external "open this thread" request by
routing to `/webview` with new params. A push notification tap used
`router.push`, and the `webview` screen had no singular id, so each tap
mounted another `ProfileWebViewScreen` with its own WebView on top of
the live one. The new WebView loaded the whole web app again (white
page, skeleton, then the thread) and the old one stayed mounted
underneath with its own WebContent process and WebSocket.
`ThreadOpenSignalHandler` did the same for `bb thread open`, although
the page already handles that signal itself. Deep links and shares
changed `requestedPath`, which was part of the WebView key, so they
remounted the WebView. Issue: get-bb#8246.

## What changed

- `packages/mobile-bridge`: a shell-to-page `navigate` event
(app-relative paths only) and a page-to-shell `capabilities` message.
Unknown capabilities are dropped, and older shells already drop the
unknown message type.
- `apps/app`: `NativeShellNavigator` takes `navigate` events through the
app's router and reports the `navigate` capability once per page load.
It does nothing outside the shell.
- `apps/mobile`:
- The `webview` stack screen is singular (`dangerouslySingular`), so a
push to `/webview` reuses the mounted screen instead of stacking another
WebView.
- `ProfileWebViewScreen` consumes `profileId`/`path` params as one open
request and clears them, so the same notification tapped again still
opens. `requestedPath` is no longer part of the WebView key. When the
page is loaded and has reported `navigate`, the shell sends the event
and keeps the WebView. Otherwise (a page from an older server, a page
still loading or failed, or a server switch) it loads the path in the
same WebView, as before.
- `ThreadOpenSignalHandler` is removed; the page's own `thread-open`
handler opens the thread.
- No change to `MOBILE_BRIDGE_VERSION`: the additions are optional on
both sides.

## How you verified

iOS Simulator (iPhone 17 Pro, iOS 26.5), Release simulator build of
`apps/mobile`, JS bundles from `expo export:embed --bytecode` of `main`
and of this branch, against a source build of bb with a seeded data dir,
Direct URL server, push notifications on. A logging proxy recorded
document loads, and screenshots were taken every ~150 ms after each tap.

| Notification tap with the page alive | `main` | this branch |
|---|---|---|
| Document load of the thread | yes | no |
| WebContent processes after 2 taps | 3 (~0.5 GB RSS each) | 1 |
| Thread on screen after the tap | 1.5 to 1.8 s, white page from ~0.5 s
| 0.5 to 0.6 s (one run 1.1 s), no white page |

Also on this branch:
- `bb thread open` and a `bb://projects/<p>/threads/<t>` deep link open
the thread in place: no document load, still one WebView.
- Tapping a notification for the same thread again after moving to
another thread opens it again in place.
- Older page (served `apps/app/dist` from `main`) with this shell: the
tap loads the thread in the same WebView, one WebContent process.
- Cold start from a notification: one WebView, the notified thread loads
directly.
- WebContent process killed in the background (`kill -9`, as iOS does
under memory pressure): the shell still reloads on resume, at the thread
last opened in place.

Unit tests: `shell-state.test.ts` (`resolveShellOpen`,
`resolveShellLoadPath`), `messages.test.ts` (capabilities parsing),
`native-shell.test.ts` (`NativeShellNavigator` navigates on the event,
reports the capability, ignores `//host` and absolute URLs, stays silent
outside the shell).

`pnpm exec turbo run lint typecheck test --filter=@bb/mobile
--filter=@bb/mobile-bridge --filter=@bb/app`: lint and typecheck pass in
all three packages; `@bb/mobile` and `@bb/mobile-bridge` tests pass;
`@bb/app` has 7,485 passing and 2 failing tests, both in
`ThreadDetailPromptArea.test.tsx` ("keeps a delayed bottom upload owned
by the bottom draft", "dismisses a missing queued message but keeps a
stale edit recoverable"). The same two fail on `main` at `a8c32288c`
with this change reverted.

Not tested: Android, and switching servers from a notification (no
second server in this setup; that path keeps the existing reload
behaviour).

Fixes get-bb#8246

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants