diff --git a/src/libs/store/store.ts b/src/libs/store/store.ts index cff2b8e7e450ab01da908a3822aaf590475ee268..a625de17876d0aea6f28525dafa20c822816bab9 100644 --- a/src/libs/store/store.ts +++ b/src/libs/store/store.ts @@ -112,7 +112,7 @@ export class Store { } } - // Cache sub objects + // Cache nested resources if (resource.getSubObjects) { for (let res of resource.getSubObjects()) { const resourceProxy = new CustomGetter(res['@id'], res, clientContext, parentContext, parentId).getProxy(); @@ -121,7 +121,7 @@ export class Store { } } - // Cache children + // Cache children of container if (resource['@type'] == "ldp:Container" && resource.getChildren) { for (let res of resource.getChildren()) { this.subscribeResourceTo(resource['@id'], res['@id']); @@ -133,8 +133,10 @@ export class Store { // Cache resource if (resource['@id'] && !resource.properties) { if (resource['@id'].match(/^b\d+$/)) return; // not anonymous node - if (resource['@type'] === "ldp:Container") { // if source, init graph of source - await this.getData(resource['@id'], clientContext, parentId); + if (resource['@type'] === "ldp:Container" // if object is container (=source) + || (Object.keys(resource).length === 1 && resource['@id']) // or has only one prop @id + ) { + await this.getData(resource['@id'], clientContext, parentId); // then init graph return; } const resourceProxy = new CustomGetter(resource['@id'], resource, clientContext, parentContext, parentId).getProxy();