Skip to content

Conversation

@HeyImChris
Copy link

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Downstream we load the JS bundles as platform specific packages. Doing this requires the JS runtime initialization to be completed. There's currently no notification or delegate call I've found that can easily transfer this information to our ReactNativeInstance. Essentially we need to be notified after the JS runtime has initialized but before the executeSourceCode begins as we have a requirement that part of our bundle loading uses the JS runtime.

I've looked at when the notifications in RCTBridge.h fire (e.g. RCTJavaScriptDidLoadNotification, RCTJavaScriptWillStartExecutingNotification, and a few others) and none of them fire at the time we need.

Changelog

[iOS/macOS] [Task] - Fixes a race condition where the loadBundle thread that runs in a parallel to the JS runtime initialization thread tries to access global variables like __fbbbatchedbbridge before they're set.

Test Plan

I tested an analogous build downstream with RCTJavaScriptDidLoadNotification and everything seems to be able to get hooked up correctly, but the event comes at the wrong time and occasionally we still crash. Posting the notification when we do with this PR should remedy that.

HeyImChris and others added 15 commits February 4, 2021 11:38
* Update RCTCxxBridge.mm

* add nullability checks
@HeyImChris HeyImChris requested a review from harrieshin April 23, 2021 22:30
@HeyImChris HeyImChris self-assigned this Apr 23, 2021
@HeyImChris HeyImChris requested a review from alloy as a code owner April 23, 2021 22:30
@pull-bot
Copy link

pull-bot commented Apr 23, 2021

Warnings
⚠️

❔ Base Branch - The base branch for this PR is something other than master. Are you sure you want to merge these changes into a stable release? If you are interested in backporting updates to an older release, the suggested approach is to land those changes on master first and then cherry-pick the commits into the branch for that release. The Releases Guide has more information.

Messages
📖

📋 Verify Changelog Format - A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

DetailsCATEGORY may be:
  • General
  • macOS
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

Generated by 🚫 dangerJS against f33a681

@harrieshin
Copy link

don't forget to bring it to main

@HeyImChris
Copy link
Author

don't forget to bring it to main

Yea want to verify all is good here first and then I'll merge it over to main

@HeyImChris HeyImChris merged commit 202545e into microsoft:0.63-stable Apr 24, 2021
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Jun 11, 2021
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.

4 participants