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(common): unbindAll with a group name should remove all tagged ones #1152

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Oct 26, 2023

  • previous PR feat(common): add group name to bind and unbindAll methods #1150 brought this new feature but it came with a bug that is if the bounded events to unbind are at the end of the array and we called unbindAll, it wasn't removing all expected events because calling splice within the logic was reindexing the array causing an index offset and by doing so, it missed unbounding some of them
  • the best approach is to loop in reverse order which has no consequences on the array indexes and will not cause any index offset
  • also add possibility to call multiple group names with unbindAll([...])

- previous PR #1150 brought this new feature but it was found that if the bounded events to unbind are at the end of the array and we called `unbindAll`, it wasn't removing all espected events because calling `splice` whithin the logic was reindexing the array causing an index offset and it missed unbounding them all.
- the best approach is to loop in reverse order which has no consequences on the array indexes and will not cause offset
@ghiscoding ghiscoding merged commit 5014354 into master Oct 26, 2023
3 checks passed
@ghiscoding ghiscoding deleted the bugfix/unbind-all-reverse-order branch October 26, 2023 18:51
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.

2 participants