A framework for building native applications using React
Avoid crashes when RCTInstance is ready but modules are loaded (#50499)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50499 We enocuntered an issue internally where the `RCTInstance` was ready before the modules were done registering statically. When this happens, it can occur that we iterate over an array that is going to be modified. With this change, we are introducing several changes: - By default the logs are not outputted, so the array is not going to be populated - we are making a copy of the array before we start iterating, so even if the original reference is updated, the iteration is safe - we are not emitting logs if in release mode. This will protect production from this issue. Also, these warns are not going to be useful in production anyway. ## Changelog: [Internal] - fix crash when RCTInstance is ready while modules are initialized ## Facebook: This fixes T220205371 Reviewed By: Abbondanzo Differential Revision: D72512518 fbshipit-source-id: 32e561111d034455a6a778d05af4a96602b74bfb
R
Riccardo Cipolleschi committed
c0d96a5bc63ca4e1c1bf4d9a3753dd8d96d7d433
Parent: f0ad394
Committed by Facebook GitHub Bot <[email protected]>
on 4/6/2025, 9:23:30 AM