While working on #2149237: Upgrade from Backbone 0.9.2 to >=1.0.0 and from Underscore 1.4.0 to >=1.5.0, I found several subtle bugs (most of which were not causing any problems for the end user):

  1. There are still a few cases where a model attribute was being changed in response to another attribute change without waiting for the first change to be propagated first.
  2. When the Entity model enters the 'committing' state, it transitions non-candidate-ish fields to the 'candidate' state. That's good. But it also triggers a 'change:state' event on those fields that are already in a candidate-ish state. That's unnecessary, because a user can only save an entity if changes have been made, and once that happens, it's impossible to not have an in-place editor open, which by definition prevents you from having *only* candidate-ish fields. So at least one field will be transitioned to the 'candidate' state, and hence we don't have to trigger the 'change:state' event on candidate-ish fields.
  3. While the Entity model is in the 'committing' state, a field may be saved, but in that case, the 'inTempStore' attribute won't be set. While in the 'opened' state, that *does* happen. It should *also* happen while in the 'committing' state.
  4. The Entity and Field models' validate() method tried to return early if another attribute than the state one was being changed. But that code was pointless: Backbone does not support this (it doesn't want to: it wants you to always validate the entire thing).
  5. Only for one View, there was still Edit module-namespaced events in the event map. This is pointless: Backbone already assigns a dynamically generated, unique event namespace to ensure proper unbinding.

Comments

wim leers’s picture

Title: Fix subtle bugs » Fix subtle bugs discovered in the Backbone upgrade
Related issues: +#2149237: Upgrade from Backbone 0.9.2 to >=1.0.0 and from Underscore 1.4.0 to >=1.5.0
wim leers’s picture

Title: Fix subtle bugs discovered in the Backbone upgrade » Fix subtle bugs discovered while working on the Backbone upgrade
wim leers’s picture

Status: Active » Fixed
Issue tags: -sprint

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.