[NodeAPI] TurboModule jsRespresentation_ cache fails to set property #14128
Labels
Area: Turbo Modules
bug
New Architecture
Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Milestone
When getting a turbomodule, RN creates a JS object wrapper that it uses to cache the results of __turboModuleProxy.get :
https://github.com/facebook/react-native/blob/48ea6867a96bd16dc7aed9af5a8e9ce12a487c22/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp#L178
Here it creates a jsi::Object, which it stores in the TurboModules jsRepresentation_ property. It then sets the new Object's 'proto' property to the actual turbomodule hostobject. then returns that jsi::Object to JS.
Now when the JS gets a value from the TurboModule it goes to TurboModule::get, which uses TurboModule::create to get the value of the property, then attempts to cache the result by setting the result in the jsRepresentation_ object that it created earlier:
https://github.com/facebook/react-native/blob/48ea6867a96bd16dc7aed9af5a8e9ce12a487c22/packages/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h#L64
But for some reason, that set ends up in HostObject::set, which throws:
https://github.com/facebook/react-native/blob/48ea6867a96bd16dc7aed9af5a8e9ce12a487c22/packages/react-native/ReactCommon/jsi/jsi/jsi.cpp#L179
I dont understand why it gets into HostObject::set, as the jsRepresentation_ object was just a plain jsi::Object. I wouldn't expect a set on the jsi::Object to end up in HostObject::set.
The text was updated successfully, but these errors were encountered: