erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12k stars 2.5k forks source link

Reason hot reload not working on class with decorator #993

Open xaevir opened 8 years ago

xaevir commented 8 years ago

Fresh clone on a fresh xubuntu install. Is there a reason why changing the containers/Home/Home.js file will hot reload but changing the components/CounterButton/CounterButton.js will not hot reload. Checking the network, the client is receiving a xxxxxx-hot-update.js file with the correctly updated module but the page does not update. Any reason why hot loading would work in one place but not another?

Dattaya commented 8 years ago

If CounterButton is a functional component, then the reason is that react-transform-hmr does not support functional components, see gaearon/react-transform-hmr#6. Another interesting discussion: reactjs/redux#1455

xaevir commented 8 years ago

Thanks @Dattaya you gave a new way to think about the problem. As of right now this project hasn't switched to functional components yet so that's not it. But you lead me to thinking about what could be different in the two class definitions and one has a decorator. If I remove the decorator the CounterButtonjs will hot reload. Thank you.

Dattaya commented 8 years ago

I'm sorry my answer wasn't very helpful; I should've looked into the code first. Hot reloading works for all of my decorated classes (my classes are only decorated with @pureRender, @connect and @connectData), I don't know why it won't work with @connectMultireducer.