Closed tliao closed 10 years ago
Mer... yeah, I get what you're say and will put this at the top of my backlog to address.
Just an update... I do still consider this a priority issue; however it has deep and tricky enough implications that it's not a quick and easy item to sit down and address.
No worries; I would've offered a pull request but I realized it was deeper than I was comfortable with.
I ended up treating the need to have change events fired in a particular order as a code smell on my end and used custom events to work around it.
Would still like to see it fixed, but it's not blocking me so take your time :)
This should be fixed, see 2d46296. All event triggers are now deferred until the entire set
operation runs. Computed attributes simply log an event to be triggered while setting rather than firing off immediately. Computed attributes should also now honor a {silent: true}
option, which they apparently didn't before.
Great thanks! :)
Attempting to set a mix of computed and non-computed attributes on a model causes an unexpectedly early trigger of 'change' on the model. Normally this is triggered after all of the attributes have been set and all the 'change:attributes' have been fired.
With epoxy, set will call deepModelSet which eventually calls EpoxyComputedModel.change(). This triggers a 'change' event on the model as soon as it's called, regardless of whether the other non-computed attributes have been set yet.