Skip to content

Comments

fix(ios): reload sandbox when jsBundleSource prop changes#18

Open
CAMOBAP wants to merge 1 commit intomainfrom
fix/reload-sandbox-on-bundle-source-change
Open

fix(ios): reload sandbox when jsBundleSource prop changes#18
CAMOBAP wants to merge 1 commit intomainfrom
fix/reload-sandbox-on-bundle-source-change

Conversation

@CAMOBAP
Copy link
Collaborator

@CAMOBAP CAMOBAP commented Feb 20, 2026

Fixes the issue where changing the jsBundleSource prop does not reload the sandbox with the new bundle. Alternative approach to #17 — instead of destroying and recreating the entire RCTReactNativeFactory, this triggers a reload on the existing RCTHost.

Why this approach is better than #17

RCTHost is initialized with a bundleURLProvider closure that calls the delegate's bundleURL method on every reload. Since updateProps already updates the delegate's _jsBundleSource, we just need to tell the host to reload — it will pick up the new URL automatically.
Recreating the factory (as proposed in #17) is overkill because it tears down:

  • The RCTRootViewFactory
  • The RCTHost and its RCTInstance / JSI runtime / all surfaces
  • All registered JSI functions (postMessage, setOnMessage, error handler)
    ...then rebuilds everything from scratch. This causes a visible blank flash and is unnecessarily expensive.

RCTHost is initialized with a bundleURLProvider closure that calls the
delegate's bundleURL on every reload. Trigger host reload instead of
recreating the entire factory to pick up the new bundle URL.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CAMOBAP CAMOBAP force-pushed the fix/reload-sandbox-on-bundle-source-change branch from a92974a to 31d49c3 Compare February 20, 2026 11:28
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.

2 participants