Closed janpaul123 closed 8 years ago
Note that the CI only fails because it seems to not run on Saucelabs because of credentials issues, the actual test I wrote for this passes. (And fails without the patch.)
Yep, this makes sense. Thanks for taking the time to make this PR it looks like it took a bit of time to work out and test.
+1 from me.
@wraithgar Thanks! Anything else necessary before this can get merged (the build environment seems to need to get fixed). I'd love to be able to point to regular ampersand-state again instead of to my clone. :smiley:
I was giving this some time to see if we got any other feedback from another ampersand.js member. Looks like nobody had anything to add so I'll go ahead and merge this.
Just a heads up we'll probably wait to ship this w/ the next major versoin of ampersand-state
(which should be very soon, this PR is in works and has lots of attention on it) https://github.com/AmpersandJS/ampersand-state/pull/236
Actually it'd be best for you and others if I released the patch with this fix so you could update your stuff now instead of coupling this bugfix w/ the update to lodash 4. I'll publish this now.
published as v5.0.1
Thanks a lot @wraithgar! We also might want to bump the versions on ampersand-model and ampersand-view some time soon — in the latest version they're pointing to ampersand-state 4.x.
yeah looks like those PRs never got made. I should think that update will make it into the version bumps being done for the lodash updates, but if you want one in the interim feel free to make PRs for that separately.
Ampersand used to just call
this.stopListening
on a property of type "state" whenever we changed it out for some other object. However, this also unbinds any other listeners on that object, unexpectedly.Instead, we should keep a reference to the handler, which we do by changing
_getEventBubblingHandler
into_getCachedEventBubblingHandler
and saving it for thepropertyName
. This way, we can unbind just the handler we just set, and leave other event listeners untouched.