jeudi 21 mai 2015

Rolling back a model after failed delete doesn’t update view

I'm trying to catch and handle a failed delete request by rolling back the model and having it remain in the view, but I'm having problems. I've got the following in my controller's delete action:

model.delete();

model.save().then(function() {

  alert('Deleted!);

}, function(err) {

  alert('Delete failed...');
  model.rollback();

});

This seems to work fine, I can see that the model quickly disappears from the store and then is instantly added back in, however the problem is that it just doesn't reappear in the view.

Both before and after the delete/rollback the model has the following properties

isLoaded:true
isDirty: false
isSaving: false
isDeleted: false
isError: false
isNew: false
isValid: true

I'm on Ember 1.11.1 and Ember Data 1.0.0-beta.16.1

Is this expected behaviour, or am I missing something? Any info would be greatly appreciated!




Aucun commentaire:

Enregistrer un commentaire