ruby-hyperloop / hyper-react

The project has moved to Hyperstack!!
https://hyperstack.org/
MIT License
285 stars 14 forks source link

Double check all call back handlers #232

Open catmando opened 6 years ago

catmando commented 6 years ago

All callback handlers that take parameters (component_will_receive_props, component_will_update, component_did_update) as well as should_component_update? are actually broken ATM.

The params to these methods are hashes, and the create_native_react_class method was refactored so that the conversion from a JS object to Opal Hash is done in before the method is called.

However the methods themselves still assume that a native JS object is coming in and redoes the conversion. Current version of Opal in this case does not simply return a hash if you try to create a hash this way. I suspect previous versions had a different behavior, and hence this error was not caught.

The fix is easy, the problem is it will change the behavior of these methods. For example see #213 .

So when we fix we should include a mechanism to turn on the old behavior with a deprecation notice.

janbiedermann commented 6 years ago

behaviour is fixed the 1.0.0 laps no deprecation warning has been added it should be documented that callbacks receive ruby hashes as args