asciidisco / asciidisco/Backbone.Mutators

Setting hashes with Mutators breaks Backbone atomicity

Open
#26 1 comment 0 reactions 1 assignee Claimed by @asciidisco View on GitHub
bug
Dominant language
JavaScript
Stars
227
Forks
27
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.