mirror of
https://github.com/nasa/openmct.git
synced 2025-01-20 03:36:44 +00:00
[Persistence] Only auto-persist previously saved domain objects
This commit is contained in:
parent
6418b0c634
commit
b0cbb5a2b4
@ -202,6 +202,15 @@ define(
|
||||
return this.identifierService.parse(id).getSpace();
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this domain object has been persisted at some
|
||||
* point.
|
||||
* @returns {boolean} true if the object has been persisted
|
||||
*/
|
||||
PersistenceCapability.prototype.persisted = function () {
|
||||
return this.domainObject.getModel().persisted !== undefined;
|
||||
};
|
||||
|
||||
return PersistenceCapability;
|
||||
}
|
||||
);
|
||||
|
@ -34,7 +34,9 @@ define([], function () {
|
||||
var mutationTopic = topic('mutation');
|
||||
mutationTopic.listen(function (domainObject) {
|
||||
var persistence = domainObject.getCapability('persistence');
|
||||
persistence.persist();
|
||||
if (persistence.persisted()) {
|
||||
persistence.persist();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user