vue-mc
vue-mc copied to clipboard
Model's onDeleteSuccess behaviour makes it difficult to know what was deleted/removed
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()
?