From 693f15cc217f5fd1603f9c1ca76885b11bb704e6 Mon Sep 17 00:00:00 2001 From: Matthieu Fesselier <matthieu.fesselier@gmail.com> Date: Mon, 22 Jun 2020 10:09:58 +0200 Subject: [PATCH] bugfix: fetch containers children if no properties #634 --- src/libs/store/store.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libs/store/store.ts b/src/libs/store/store.ts index cff2b8e7..a625de17 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(); -- GitLab