[Edit] Only persist on mutation if model has actually changed locally. Fixes #1482

This commit is contained in:
Henry
2017-03-26 19:13:05 -07:00
parent 8830ee8c2d
commit 222f852af4
2 changed files with 28 additions and 13 deletions

View File

@ -148,13 +148,19 @@ define(
*/
PersistenceCapability.prototype.refresh = function () {
var domainObject = this.domainObject;
var $q = this.$q;
// Update a domain object's model upon refresh
function updateModel(model) {
var modified = model.modified;
return domainObject.useCapability("mutation", function () {
return model;
}, modified);
if (model === undefined) {
//Get failed, reject promise
return $q.reject('Got empty object model');
} else {
var modified = model.modified;
return domainObject.useCapability("mutation", function () {
return model;
}, modified);
}
}
if (domainObject.getModel().persisted === undefined) {