diff --git a/lib/models/data-model.js b/lib/models/data-model.js index 6b5bf5fb..973ed7b4 100644 --- a/lib/models/data-model.js +++ b/lib/models/data-model.js @@ -882,13 +882,13 @@ DataModel.enableChangeTracking = function() { Change.attachTo(this.dataSource); Change.getCheckpointModel().attachTo(this.dataSource); - Model.on('changed', function(obj) { - Model.rectifyChange(obj.getId(), Model.handleChangeError); - }); + Model.afterSave = function afterSave(next) { + Model.rectifyChange(this.getId(), next); + } - Model.on('deleted', function(id) { - Model.rectifyChange(id, Model.handleChangeError); - }); + Model.afterDestroy = function afterDestroy(next) { + Model.rectifyChange(this.getId(), next); + } Model.on('deletedAll', cleanup);