asciidisco / Backbone.Mutators

Backbone plugin to override getters and setters with logic
http://asciidisco.github.com/Backbone.Mutators
228 stars 30 forks source link

Setting hashes with Mutators breaks Backbone atomicity #26

Open dsaffy opened 11 years ago

dsaffy commented 11 years ago

Consider model.set({key1: val1, key2: val2});

In traditional Backbone, this will set both keys to their respective values and then fire change:key1 and change:key2 events. In other words, Backbone guarantees the atomicity of set calls with hashes. Mutators breaks this contract by firing each change event after it's value is set. So Mutators would set key1 to val1, then fire the change:key1 event, then set key2 to val2, then fire the change:key2 event.

I believe this is because of the way that calls to oldSet works in the Mutators source.

asciidisco commented 9 years ago

@dsaffy I do not really have the time to support this project anymore, if you can get in a PR, I would be happy to merge it & to release a new version, thought.