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()?
Model's onDeleteSuccess calls
this.clear()
before callingthis.removeFromAllCollections
andthis.emit('delete')
. This means thatremove
event handlers for associated collections, anddelete
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:
Would it make sense to instead call
clear()
after the finalemit()
?