diff --git a/client/src/app/ui/modules/sorting/modules/sorting-tree/services/tree.service.ts b/client/src/app/ui/modules/sorting/modules/sorting-tree/services/tree.service.ts index 4daa33bbd9..c7b084156b 100644 --- a/client/src/app/ui/modules/sorting/modules/sorting-tree/services/tree.service.ts +++ b/client/src/app/ui/modules/sorting/modules/sorting-tree/services/tree.service.ts @@ -177,6 +177,7 @@ export class TreeService { /** * Removes the `item`-property from any node in the given tree. + * Deletes empty children-arrays. * * @param tree The tree with items * @returns The tree without items @@ -188,7 +189,7 @@ export class TreeService { id: node.id }; if (node.children) { - nodeWithoutItem.children = this.stripTree(node.children); + nodeWithoutItem.children = node.children.length ? this.stripTree(node.children) : undefined; } return nodeWithoutItem; });