Skip to content

Commit f2efdd8

Browse files
committed
Fix bug: calling mutation from unmounted component
1 parent 215fc72 commit f2efdd8

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
@@ -15,7 +15,7 @@ class Section extends Component {
1515
return
1616
}
1717

18-
setTimeout(() => {
18+
this.timeoutID = setTimeout(() => {
1919
this.props.viewedSection({
2020
variables: { id }
2121
})
@@ -36,6 +36,7 @@ class Section extends Component {
3636
}
3737

3838
componentWillUnmount() {
39+
clearTimeout(this.timeoutID)
3940
window.removeEventListener('scroll', this.handleScroll)
4041
}
4142

0 commit comments

Comments
 (0)