diff --git a/platform/core/bundle.js b/platform/core/bundle.js index 93b64f5739..294d339692 100644 --- a/platform/core/bundle.js +++ b/platform/core/bundle.js @@ -372,7 +372,10 @@ define([ "services": [ { "key": "cacheService", - "implementation": ModelCacheService + "implementation": ModelCacheService, + "depends": [ + "topic" + ] }, { "key": "now", diff --git a/platform/core/src/models/ModelCacheService.js b/platform/core/src/models/ModelCacheService.js index 0e3daf2121..0ddb279251 100644 --- a/platform/core/src/models/ModelCacheService.js +++ b/platform/core/src/models/ModelCacheService.js @@ -28,8 +28,13 @@ define([], function () { * @constructor * @memberof platform/core */ - function ModelCacheService() { + function ModelCacheService(topic) { this.cache = {}; + topic('mutation').listen(function (domainObject) { + if (this.has(domainObject.getId())) { + this.put(domainObject.getId(), domainObject.getModel()); + } + }.bind(this)); } /**