Skip to content

Commit 9a36a78

Browse files
authored
Important ! Listener is not removed
There is no ID for the new listener so actually when the component is updated it keeps creating new listeners.
1 parent db77930 commit 9a36a78

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/TriggeringView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class TriggeringView extends Component<Props, State> {
7474
return;
7575
}
7676
this.context.scrollY.removeListener(this.listenerId);
77-
nextContext.scrollY.addListener(this.onScroll);
77+
this.listenerId = nextContext.scrollY.addListener(this.onScroll);
7878
}
7979

8080
onRef = (ref: any) => {

0 commit comments

Comments
 (0)