Closed mvcatsifma closed 8 years ago
The implementation could be something like this: (not tested)
Resource.$load
:
$load: {value: function (ts) {
if (!this.$syncTime || (ts && this.$syncTime < ts)) {
return this.$context.httpGet(this);
} else {
return $q.when(this);
}
}},
(Not too sure about the conditional here, but you get the point.)
Context.refresh
:
refresh: {value: function (ts) {
if (!ts) ts = Date.now();
var promises = [];
angular.forEach(this.resources, function (resource) {
if (resource.$isSynced) {
promises.push(resource.$load(ts));
}
});
return $q.all(promises);
}},
@mvcatsifma Is this still an issue?
@jcassee Ja, en ik wil deze week de implementatie doen.
Fixed by #31.
The resource api will not let us refresh a resource and all it's reachable paths from the server. A kind of loadPaths that gets the resources and it's reachable paths, while still honouring embedded resources.
context.refresh gets all resources in the context from the server, leading to unnecessary requests.