Skip to content

fix: prevent nodeData.onHandlers overwrite#1862

Closed
raphael-p wants to merge 5 commits into
bigskysoftware:masterfrom
raphael-p:master
Closed

fix: prevent nodeData.onHandlers overwrite#1862
raphael-p wants to merge 5 commits into
bigskysoftware:masterfrom
raphael-p:master

Conversation

@raphael-p

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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