You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, one of the components in my app copies or maps the model, sorts it, slices it, and then loops through the data.
// initial property copiedinitial: function(){returnthis.get('model').slice()}.property('model'),// sortedsortProp: ['age:desc'],sorted: Ember.computed.sort('initial','sortProp'),// slice it and then loop through it - this function runs twicefinal: function(){returnthis.get('sorted').slice(0,5)}.property('sorted.[]'),
The issue is that the final() is triggered twice when the model is changed. The first time final() runs, Em.computed.sort is still using data from the old model (which contains 3 items). Only during the second time does Em.computed.sort use the new, updated model data (which contains 4 items).
I'm not sure as to why the sort function runs twice - whether I messed something up or it's actually a bug.
The text was updated successfully, but these errors were encountered:
I'm having problems with
Em.computed.sort
which seems to be triggered twice and ends up causing a bunch of other issues in my app.See my SO question or my jsbin for a simplified version.
Basically, one of the components in my app copies or maps the model, sorts it, slices it, and then loops through the data.
The issue is that the
final()
is triggered twice when the model is changed. The first timefinal()
runs,Em.computed.sort
is still using data from the old model (which contains 3 items). Only during the second time doesEm.computed.sort
use the new, updated model data (which contains 4 items).I'm not sure as to why the sort function runs twice - whether I messed something up or it's actually a bug.
The text was updated successfully, but these errors were encountered: