Skip to content

Commit

Permalink
Set this.mounted to false when dynamic component is unmounted (#4333)
Browse files Browse the repository at this point in the history
Otherwise you may get a React warning about calling setState() on an unmounted component.
  • Loading branch information
wereHamster authored and timneutkens committed May 11, 2018
1 parent d3c710b commit 7f62132
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f62132

Please sign in to comment.