diff --git a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js index 8d39b61992..04eb83d7c6 100644 --- a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js @@ -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; } diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 6c1407aa17..666790601b 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -50,7 +50,7 @@ define( // Persist the underlying domain object function doPersist() { - return persistenceCapability.persist(); + return domainObject.getCapability('persistence').persist(); } return { diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index 9175b2f85e..112dba3593 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -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