Skip to content

Commit ac2ca81

Browse files
committed
Fix bug: calling mutation from unmounted component
1 parent df89f09 commit ac2ca81

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
@@ -31,7 +31,7 @@ class Section extends Component {
3131
return
3232
}
3333

34-
setTimeout(() => {
34+
this.timeoutID = setTimeout(() => {
3535
this.props.viewedSection({
3636
variables: { id }
3737
})
@@ -51,6 +51,7 @@ class Section extends Component {
5151
}
5252

5353
componentWillUnmount() {
54+
clearTimeout(this.timeoutID)
5455
window.removeEventListener('scroll', this.handleScroll)
5556
}
5657

0 commit comments

Comments
 (0)