-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 bug where EventBus handlers are removed before execution #1774
Fix bug where EventBus handlers are removed before execution #1774
Conversation
Seems like a great fix. just missed the release ;) Thanks for the commit. |
@AkamaiDASH
Darn! How often does your team release? |
9876e0d
to
cc621d4
Compare
If you remove the handler currently being executed, the next handler in the list will not be run.
cc621d4
to
36aa243
Compare
6 weeks or so. It will get merged this week into dev and nightly. |
@justinanastos Looks like we have a regression here from last release that will hold up this release. I can either revert your change or you can try to address it. |
Thanks for the heads up @AkamaiDASH , I'll look into the regression today. |
I reviewed #1889 and it doesn't seem like this PR (#1744) caused a regression, but revealed a bug in the code elsewhere.
As far as I can understand, this is a mistake. calling |
I think anyone calling Before this PR, calling Another approach might be to set |
Looking again with fresh eyes, you are totally right and I was mistaken. I apologize for my hasty response, I didn't read #1889 correctly. The bug I was trying to fix can be seen here: https://jsbin.com/haculos/2/edit?js,console While traversing the array of handlers, if a handler removes the event listener for the current handler, the next handler will not be called. A apparently didn't understand how @bbcrddave I like your gist. I submitted PR #1891 with one variation: I used |
All agree we should hold the release until we sort this one out? |
fix(EventBus): Fix faulty logic for `off`, caused by #1774
Stop mutating
handlers[type]
inEventBus#off
. Doing so prevents all handlers from being run ifoff()
is called while executing a callback.Fixes #1773