What you are reporting: bug
lazy modules should update like usual modules
they doesn't update
React Hot Loader v3
Run these commands in the project folder and fill in their results:
node -v: v7.4.0npm -v: 4.0.5Then, specify:
I investigated this issue and it seems like it's caused by componentWillMount function:
https://github.com/mqklin/hot-loader-lazy-modules-bug/blob/1dc695dbe9d1f5665882449b47c0676849895a57/src/App.js#L10.
The problem is that once your component is loaded, componentWillMount will not be called again when you don't have any changes while updating. And this is how RHL actually works at the moment.
Please try to follow lazy loading react guide on a webpack site (https://webpack.js.org/guides/lazy-load-react/) and let us know if it works for you.
That code is so verbose... I'm sure it's work, but I don't want to use it. I got the point that I should call require somewhere every time component updates.
I included require('./Lazy'); inside componentWillReceiveProps and it works now:
componentWillReceiveProps() {
if (__DEV__) require('./Lazy');
}
You said:
And this is how RHL actually works at the moment.
Will this change in the future?
Probably we should consider a case when some run-only-once method has a dependency on some other module that was hot updated and then provide a full reload for that component when async.
Thanks for the bug label. I hope this will be fixed someday.
All of this is outdated. I close it.