Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8393 from NejcZdovc/redux/unmount
Browse files Browse the repository at this point in the history
Removes last check when component is unmounting
  • Loading branch information
NejcZdovc authored Apr 24, 2017
2 parents 2212b33 + f4f11a3 commit 506036e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/renderer/components/reduxComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ class ReduxComponent extends ImmutableComponent {
this.componentType = props.componentType
this.state = buildPropsImpl(props, this.componentType)
this.checkForUpdates = this.checkForUpdates.bind(this)
this.dontCheck = false
}

checkForUpdates () {
if (this.shouldComponentUpdate(this.props, this.buildProps())) {
if (!this.dontCheck && this.shouldComponentUpdate(this.props, this.buildProps())) {
this.forceUpdate()
}
}
Expand All @@ -33,6 +34,7 @@ class ReduxComponent extends ImmutableComponent {
}

componentWillUnmount () {
this.dontCheck = true
appStore.removeChangeListener(this.checkForUpdates)
windowStore.removeChangeListener(this.checkForUpdates)
}
Expand Down

0 comments on commit 506036e

Please sign in to comment.