Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

extending prototype functions in order to fix hot loader #252

Closed

Conversation

bobbyrenwick
Copy link
Contributor

This also removes the setting up of the initial this.state._radiumStyleState because there's no way to reconcile the differences between ES6 classes and React.createClass without creating a wrapping constructor that kills hot loading. It also removes the tests for that behaviour because it doesn't actually seem to negatively affect the behaviour.

You can see that this branch works with hot loader by cloning my fork of react-hot-boilerplate - https://github.com/bobbyrenwick/react-hot-boilerplate/tree/test-radium-hoc.

The only thing I'm not too sure about is that I've deleted some Flow annotations and I'm not sure what sort of effects that will have as I haven't had much time to play around with it! @ianobermiller is there anything Flow related that needs to be done?

Fixes #219

This also removes the setting up of the initial this.state._radiumStyleState
because there's no way to reconcile the differences between ES6 classes
and React.createClass without creating a wrapping constructor that kills
hot loading
@bobbyrenwick
Copy link
Contributor Author

So I've been testing this out on our app today and it seems that there are some issues with this. I will let you know more once I've done some more testing.

@bobbyrenwick
Copy link
Contributor Author

So the issue was caused by removing, _radiumStyleState from the initialState while using PureRenderMixin. For example, on a hover, in shallowEqual we end up comparing a state of null (the initial state) to a state of {"_radiumStyleStyle": {...etc}} and get cannot read property hasOwnProperty of null

@bobbyrenwick
Copy link
Contributor Author

Closing in favour of #255 because that doesn't have the same issues with PureRenderMixin and no initial state being set.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant