1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Set this.mounted to false when dynamic component is unmounted (#4333)

Otherwise you may get a React warning about calling setState() on an unmounted component.
This commit is contained in:
Tomas Carnecky 2018-05-11 17:07:06 +02:00 committed by Tim Neutkens
parent d3c710b325
commit 7f621324fc

View file

@ -137,6 +137,10 @@ export default function dynamicComponent (p, o) {
this.loadBundle(nextProps)
}
componentWillUnmount () {
this.mounted = false
}
render () {
const { AsyncComponent, asyncElement } = this.state
const { LoadingComponent } = this