react-scroll icon indicating copy to clipboard operation
react-scroll copied to clipboard

Fail to update scroll listener in 1.9.0, due to wrong deduplication implementation

Open WangLeto opened this issue 2 years ago • 3 comments

https://github.com/fisshy/react-scroll/blob/526bab0e682ee941b53ff4fba7e6d5c40abe0144/modules/mixins/passive-event-listeners.js#L13-L15

Version 1.9.0 added a deduplication mechanism for event listeners, but did not remove the corresponding records. This causes the component to fail to update the event listener when it is remounted and the container is specified.

WangLeto avatar Nov 28 '23 10:11 WangLeto

oh, good find, could you make a PR fixing it? :)

fisshy avatar Nov 28 '23 10:11 fisshy

@fisshy Hi, I've submitted a PR.

By the way I noticed it seems the scrollSpyContainer hasn't never been removed. A possible solution is to check and remove unused containers by isConnected during the execution of scrollSpy.mount. :) refer: https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected

WangLeto avatar Nov 29 '23 07:11 WangLeto