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

fix: prevent unexpected spy callback removal on multiple unmount calls #519

Merged
merged 2 commits into from
Oct 20, 2022

Conversation

dmitriynazaratiy
Copy link
Contributor

@dmitriynazaratiy dmitriynazaratiy commented Oct 19, 2022

Problem:
Multiple scrollSpy.unmount() calls may occur on same Link due to component tree rebuild. Subsequent calls will try to remove already non-existing spyHandler. In this case .indexOf(spyHandler) will return -1 and .splice(-1, 1) will cause unwanted removal of last spyHandler in list.
Same with setState handlers.

Solution
Add extra check to make sure spyHandler and setState are in lists

@michielmetcake
Copy link

Let's do this!

@fisshy fisshy merged commit 9122e0b into fisshy:master Oct 20, 2022
@fisshy
Copy link
Owner

fisshy commented Oct 20, 2022

Thanks for the PR, merged :)

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

Successfully merging this pull request may close these issues.

3 participants