vue-mc icon indicating copy to clipboard operation
vue-mc copied to clipboard

Model's onDeleteSuccess behaviour makes it difficult to know what was deleted/removed

Open longhotsummer opened this issue 3 years ago • 0 comments

Model's onDeleteSuccess calls this.clear() before calling this.removeFromAllCollections and this.emit('delete'). This means that remove event handlers for associated collections, and delete event handlers on the model, don't have access to the details of the model that has been deleted.

This makes code like the following impossible:

collection.on('remove', e => {
  if (e.model.important_attribute) {
    // an important model was deleted
  }
});

Would it make sense to instead call clear() after the final emit()?

longhotsummer avatar Oct 02 '20 14:10 longhotsummer