Skip to content

Commit 0a6aa9e

Browse files
committed
Fix bug: calling mutation from unmounted component
1 parent f7a9fa0 commit 0a6aa9e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/Section.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Section extends Component {
3333
return
3434
}
3535

36-
setTimeout(() => {
36+
this.timeoutID = setTimeout(() => {
3737
this.props.viewedSection({
3838
variables: { id }
3939
})
@@ -53,6 +53,7 @@ class Section extends Component {
5353
}
5454

5555
componentWillUnmount() {
56+
clearTimeout(this.timeoutID)
5657
window.removeEventListener('scroll', this.handleScroll)
5758
}
5859

0 commit comments

Comments
 (0)