-
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
Make setJSEngineResolutionAlgorithm a public method #36715
Conversation
Co-authored-by: Sparsha Saha <[email protected]>
Base commit: a44d8a0 |
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi @SparshaSaha, thank for the PR. However, I don't think we should change the visibility of this method. The way a JS engine is set is through the setJavaScriptExecutorFactory, not through the setJSEngineResolutionAlgorithm. If you look at the code down there, we create a ReactInstance using the defaultExecutorFactory or the one passed by the user. If there is a custom executor factory, the resolutionAlgorithm is not even considered. Making this public can create inconsistencies: what happens if the app passes a JSCExecutorFactory, but it set an HermesResolutionAlgorithm? By keeping the algorithm private, we can ensure consistency. Does this make sense? Also, there is another problem: when we build for Hermes, we don't have the JSC symbols in the build, so we cannot really allow to set different resolution algorithms. |
I see @cipolleschi . Thank you for taking a look at it. It makes sense. However, in that case, do you think we can remove this method: As far as I understand, this condition will always be true right? Line 365 in a44d8a0
If that's the case can we remove this altogether? The logger says, |
yeah, you are right. I reached out to @cortinico who has more context on how this should be used. IIRC, we had to keep that variable for backward compatibility with the internal infra, unfortunately. But let's wait for his input! ;) |
Thanks for spotting this. You're right @SparshaSaha, we need to add a bit of logic as we're not properly populating the InstanceManager (that's why the method was unused). @javache took over this and is pushing a fix together with your change 👍 |
Summary: `setJSEngineResolutionAlgorithm` is marked as private while it looks like it was intended to be public. While the current implementation does not cause any issues as such, but in brownfield we will have the option to explicitly set the JS engine to hermes or jsc when initialising the ReactInstanceBuilder. Right now, we look if the engine is set and if unset we look for the jsc engine. If jsc is not present we select hermes and this process unnecessary throws a warning. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID][FIXED] - Changed the scope of `setJSEngineResolutionAlgorithm` to public from private. Brownfield apps should be able to setup the JSResolutionAlgorithm before hand. Pull Request resolved: facebook#36715 Reviewed By: cortinico Differential Revision: D44535444 Pulled By: javache fbshipit-source-id: ae91e50de10c993c80ed4bba6f2fece64af178c4
Summary: `setJSEngineResolutionAlgorithm` is marked as private while it looks like it was intended to be public. While the current implementation does not cause any issues as such, but in brownfield we will have the option to explicitly set the JS engine to hermes or jsc when initialising the ReactInstanceBuilder. Right now, we look if the engine is set and if unset we look for the jsc engine. If jsc is not present we select hermes and this process unnecessary throws a warning. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID][FIXED] - Changed the scope of `setJSEngineResolutionAlgorithm` to public from private. Brownfield apps should be able to setup the JSResolutionAlgorithm before hand. Pull Request resolved: facebook#36715 Reviewed By: cortinico Differential Revision: D44535444 Pulled By: javache fbshipit-source-id: ae91e50de10c993c80ed4bba6f2fece64af178c4
Summary:
setJSEngineResolutionAlgorithm
is marked as private while it looks like it was intended to be public.While the current implementation does not cause any issues as such, but in brownfield we will have the option to explicitly set the JS engine to hermes or jsc when initialising the ReactInstanceBuilder.
Right now, we look if the engine is set and if unset we look for the jsc engine. If jsc is not present we select hermes and this process unnecessary throws a warning.
Changelog:
[ANDROID][FIXED] - Changed the scope of
setJSEngineResolutionAlgorithm
to public from private. Brownfield apps should be able to setup the JSResolutionAlgorithm before hand.Test Plan: