[Persistence] Handle refresh after edit

Correctly handle Discard changes after leaving Edit mode when
conflicts are detected; WTD-1033.
This commit is contained in:
Victor Woeltjen 2015-03-24 15:53:27 -07:00
parent 6b43256afd
commit 0090732f71
3 changed files with 11 additions and 2 deletions

View File

@ -29,6 +29,13 @@ define(
cache.markDirty(editableObject);
};
// Delegate refresh to the original object; this avoids refreshing
// the editable instance of the object, and ensures that refresh
// correctly targets the "real" version of the object.
persistence.refresh = function () {
return domainObject.getCapability('persistence').refresh();
};
return persistence;
}

View File

@ -50,7 +50,7 @@ define(
// Persist the underlying domain object
function doPersist() {
return persistenceCapability.persist();
return domainObject.getCapability('persistence').persist();
}
return {

View File

@ -62,7 +62,9 @@ define(
// Discard changes for a failed refresh
function discard(failure) {
return failure.persistence.refresh(true);
var persistence =
failure.domainObject.getCapability('persistence');
return persistence.refresh();
}
// Discard changes associated with a failed save