mercredi 21 décembre 2016

How to ensure Ember Data remove the cache from store?

Pretty sure it's just some noob mistake I made, I've got a controller that shows the model count

const BlahController = Ember.Controller.extend({
    totalRows: Ember.computed('model.[]', function() {
        let items = this.get('model') || [];
        return items.get('length');
    }),
    ...
})

then when I delete the model I do it using destroyRecord and even ensure that it's unloaded

model.destroyRecord().then(() => {
    this.get('store').unloadRecord(model);
}

Any idea why totalRows is never updated? I would've thought that by calling store.unloadRecord it will actually remove the model from the store and updates the model array in the controller?




Aucun commentaire:

Enregistrer un commentaire