Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
WangLeto opened this issue Nov 28, 2023 · 2 comments

Comments

@WangLeto
Copy link
Contributor

if (!attachedListeners.has(eventName)) attachedListeners.set(eventName, new Set());
const listeners = attachedListeners.get(eventName);
if (listeners.has(listenerName)) return;

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.

@fisshy
Copy link
Owner

fisshy commented Nov 28, 2023

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

@WangLeto
Copy link
Contributor Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants