-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: [iOS] RCTReloadCommand should pass its bundleURL when reloading #44130
Conversation
Base commit: 2509eb7 |
Hey @douglowder! Can you please elaborate on the Expo feature and why it needs to set a custom bundle URL? |
This is for the expo-updates package. There is an API that allows a downloaded update to be immediately launched, replacing the currently running JS bundle. |
I should add that this was working in 0.73, and still works in 0.74 on Android, so this may actually be a regression. |
Hi @douglowder, we fixed something similar in Bridgeless mode, when the How are you testing it and on which react native versions? Can you test with the latest RC? |
@cipolleschi I'm testing it with 0.74.0-rc.9, in https://github.com/expo/UpdatesAPIDemo/tree/canary . It seems to work as expected for both non-Fabric and bridgeless. |
Can you elaborate more what controls how the bundleURL changes? If the What do think about this? Edit:
|
@cipolleschi the bundleURL only changes if a user calls our JS API to reload the app. If a newer bundle has been downloaded, the file URL for that bundle becomes the new bundleURL. Before the fix in this PR, the behavior is broken for us in both old architecture and new architecture bridgeless. We have not been testing with new architecture and bridge. Edit: if bundleURL should not change, what is the purpose of the |
From what I can see, the That said, I'm wondering what changed in the old architecture that broke it between 0.73 and 0.74. The regression must be fixed, but rather than adding new functions and codepath we need to maintain, it would be better to understand first what broke it. I'm not pushing back on the fix, to make it clear, but we do have to understand better what stopped working to find the best fix.
I think I know what happened. With this change, we changed the way the Before, we were asking the AppDelegate for the url and we were storing the url in a variable. This could lead to scenarios where the With that change, the reload command was changed so that, upon reload, it was re-evaluating the closure and thus getting a new url. What I think Expo was doing is to leverage that "staleness" of the variable to update it as it needed. But that's not something reliable, and in fact, we changed that. The way apps should provide the bundle URL is through the |
@cipolleschi thanks for researching this and providing a detailed analysis! Per your advice, we will close this and fix the issue on the Expo side. |
Summary:
An Expo feature that makes use of the
RCTReloadCommand
classRCTTriggerReloadCommandListeners()
to reload with a specific bundle URL is not working, because setting the bundle URL viaRCTReloadCommandSetBundleURL()
has no effect.The fix is to add a new method to the
RCTReloadListener
protocol that allows the new URL to be passed into the listener (RCTBridge
orRCTHost
) to set the bundle URL correctly before reload.Changelog:
[iOS][Fixed] RCTReloadCommand should pass its bundle URL when reloading
Test Plan:
Working on a non-Expo test app to demonstrate the fix.