SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Throw JS exception when calling a method if bufferedRuntimeExecutor is not initialized (#46735)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46735

We had some crash on Android where we call [`callFunctionOnModule`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L258) when the `bufferedRuntimeExecutor_` might not be initialized. This can happen when navigating away from RN surface and quickly navigate to another one or across refreshes.

There could be a scheduled JS function from the previous surface/instance that might try to call a native module while the new instance is being created.

This change prevent the crash and replace it with a soft crash, that should show a RedBox on the screen.

## Changelog
[Internal] - Throw JS exception when calling a method if buffereRuntimeExecutor is not initialized

## Facebook
Have a look at T201983945 that generated the crash report

Reviewed By: cortinico

Differential Revision: D63638633

fbshipit-source-id: ba331f5173963265232d0810c2d12895cea3d528
R
Riccardo Cipolleschi committed
6d6dd99ec9a0982a9dfd0693a22a1661edf81239
Parent: c441de5
Committed by Facebook GitHub Bot <[email protected]> on 10/1/2024, 5:15:50 PM