-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.0.x broke hot module reloading #193
Comments
I can reproduce it but have no idea why. All HMR configuration should be external. |
@sapegin did you change any components from class components to stateless functional components? stateless functional components cannot reload on their own, they must be wrapped at some point by a class component |
I did! Now I’m trying to change them back to classes and it doesn’t help ;-( |
Hm, I'm not sure if that's it because the root component is a proper class component, so it shouldn't be an issue. I can repro this locally too, not sure what happened. It did reload once but subsequent reloads don't happen, very odd. |
I can reproduce this too in the example. Will try to find the exact commit that breaks it. |
Here is the bad commit: f713a3e. Unfortunately the biggest one. And here I’ve introduced some functional components. |
The only solution I could find is this but I’m not sure it’s better than yours ;-| It’s hack too. @ Examples.js:15 @
const Examples = ({ examples }) => {
<Playground
code={example.content}
evalInContext={example.evalInContext}
- key={index}
+ key={Math.random()}
/>
);
case 'markdown': |
that seems worse, it'll recreate everything anytime anything is rerendered won't it? |
Yeah, I think you’re right. How about 3cf04d1? Experimenting with your branch. |
Actually I like this (vanilla Webpack HMR instead of react-transform-hmr or react-hot-loader) s approach more: no need to configure anything and performance shouldn’t be a big issue because you’d want to develop component in isolated mode anyway. |
Awesome. I'll close this and my pull out. Thanks! |
Thank you too, the solution is 90% yours! |
On 3.1.1 hot module reloading for stateless functional components worked. On 4.0.0 and 4.0.1 it no longer does for our project.
The text was updated successfully, but these errors were encountered: