add check to return rootItems if parentId is null

This commit is contained in:
Mads Rasmussen
2023-11-13 16:09:18 +01:00
parent 55645c2cd5
commit 04a2a1e9c7

View File

@@ -31,9 +31,11 @@ export class UmbFileSystemTreeStore
* @memberof UmbFileSystemTreeStore
*/
childrenOf(parentPath: string | null) {
return this._data.asObservablePart((items) =>
items.filter((item) => item.path?.startsWith(parentPath + '/') || parentPath === null)
);
if (parentPath === null) {
return this.rootItems;
}
return this._data.asObservablePart((items) => items.filter((item) => item.path?.startsWith(parentPath + '/')));
}
/**