Skip to content

Commit

Permalink
Remove 'resize' eventLinstener on TimeGrid unmount (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Shastsel authored and jquense committed Mar 17, 2018
1 parent 1d6ce68 commit b343b3d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ export default class TimeGrid extends Component {
this.positionTimeIndicator()
this.triggerTimeIndicatorUpdate()

window.addEventListener('resize', () => {
raf.cancel(this.rafHandle)
this.rafHandle = raf(this.checkOverflow)
})
window.addEventListener('resize', this.handleResize)
}

handleResize = () => {
raf.cancel(this.rafHandle)
this.rafHandle = raf(this.checkOverflow)
}

componentWillUnmount() {
window.clearTimeout(this._timeIndicatorTimeout)
window.removeEventListener('resize', this.handleResize)

raf.cancel(this.rafHandle)
}

componentDidUpdate() {
Expand Down

0 comments on commit b343b3d

Please sign in to comment.