Skip to content

Post the bundle URL before a bridgeless bundle runs - #59838

Open
briantkelley wants to merge 1 commit into
react:mainfrom
briantkelley:export-D128478252
Open

briantkelley wants to merge 1 commit into
react:mainfrom
briantkelley:export-D128478252

Conversation

@briantkelley

Copy link
Copy Markdown

Summary:
Observers cannot tell which JavaScript is about to run in bridgeless mode on iOS: RCTJavaScriptDidLoadNotification arrives on the main queue only after a bundle finishes evaluating and names it only through the bridge's current bundle URL, so a bundle that throws goes unseen, a reload in between is attributed to the new URL, and segments are never announced. RCTInstance now posts RCTJavaScriptWillStartExecutingNotification synchronously right before a bundle runs (on the JS thread) and before a segment is registered (on the registering thread), with bridge and the bundle or segment file url in userInfo, and adds url to RCTJavaScriptDidLoadNotification. RCTConstants.h states when each notification is posted, on which thread and with which keys, and that will-execute observers must not use UIKit or wait on the main thread; existing will-execute observers now receive it in bridgeless mode. Only the iOS runtime changes: the macOS copy of RCTInstance still posts did-load alone.

Changelog:
[iOS][Added] - Post RCTJavaScriptWillStartExecutingNotification with the bundle or segment url before JavaScript runs in bridgeless mode, and add url to RCTJavaScriptDidLoadNotification

Differential Revision: D128478252

Summary:
Observers cannot tell which JavaScript is about to run in bridgeless mode on iOS: `RCTJavaScriptDidLoadNotification` arrives on the main queue only after a bundle finishes evaluating and names it only through the bridge's current bundle URL, so a bundle that throws goes unseen, a reload in between is attributed to the new URL, and segments are never announced. `RCTInstance` now posts `RCTJavaScriptWillStartExecutingNotification` synchronously right before a bundle runs (on the JS thread) and before a segment is registered (on the registering thread), with `bridge` and the bundle or segment file `url` in `userInfo`, and adds `url` to `RCTJavaScriptDidLoadNotification`. `RCTConstants.h` states when each notification is posted, on which thread and with which keys, and that will-execute observers must not use UIKit or wait on the main thread; existing will-execute observers now receive it in bridgeless mode. Only the iOS runtime changes: the macOS copy of `RCTInstance` still posts did-load alone.

Changelog:
[iOS][Added] - Post `RCTJavaScriptWillStartExecutingNotification` with the bundle or segment `url` before JavaScript runs in bridgeless mode, and add `url` to `RCTJavaScriptDidLoadNotification`

Differential Revision: D128478252
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 6, 2026
@meta-codesync

meta-codesync Bot commented Nov 6, 2026

Copy link
Copy Markdown

@briantkelley has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128478252.

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant