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 nodeData.onHandlers overwrite #1862

Closed
wants to merge 5 commits into from

Conversation

raphael-p
Copy link
Contributor

@raphael-p raphael-p commented Oct 5, 2023

Related to this discussion I created: #1861

I started digging into the code a little and realised that nodeData.onHandlers can only hold one on-handler at a time since it is wiped every time addHxOnEventHandler is called. The fix is to just not do that if nodeData.onHandlers already exists.

This is fixes the cause of the problem in the linked discussion because when there are multiple on-handlers on an element, only the last one is stored. So then only the last on-handler gets removed when the DOM updates. Every other on-handler just gets re-added without getting removed beforehand.

PS: I made this PR against the master branch, but please shout if it should be dev.

@raphael-p raphael-p changed the title [fix] prevent nodeData.onHandlers() overwrite fix: prevent nodeData.onHandlers() overwrite Oct 5, 2023
@raphael-p raphael-p changed the title fix: prevent nodeData.onHandlers() overwrite fix: prevent nodeData.onHandlers overwrite Oct 7, 2023
@Telroshan Telroshan added the bug Something isn't working label Oct 13, 2023
@Telroshan
Copy link
Collaborator

Good catch!
You should indeed target the dev branch as per the contributing guidelines, could you please retarget your PR?

@raphael-p
Copy link
Contributor Author

closed in favour of #1894, which targets the dev branch

@raphael-p raphael-p closed this Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants