diff --git a/packages/elements/src/tree/managers/tree-manager.ts b/packages/elements/src/tree/managers/tree-manager.ts index 5e9f5f8122..b59b68a755 100644 --- a/packages/elements/src/tree/managers/tree-manager.ts +++ b/packages/elements/src/tree/managers/tree-manager.ts @@ -108,8 +108,7 @@ export class TreeManager { */ private getVisibleItems (items: readonly T[], result: T[] = []): T[] { for (const item of items) { - if (this.isItemVisible(item)) { - result.push(item); + if (!this.isItemHidden(item) && result.push(item) && this.isItemExpanded(item)) { const children = this.getItemChildren(item); children.length && this.getVisibleItems(children, result); } @@ -126,17 +125,6 @@ export class TreeManager { return this.composer.getItemPropertyValue(item, 'hidden') === true; } - /** - * Is the item visible? - * @param item Original data item - * @returns `True` if the item is visible - */ - private isItemVisible (item: T): boolean { - return !this.isItemHidden(item) - && !this.composer.getItemAncestors(item) - .some(ancestor => !this.isItemExpanded(ancestor)); - } - /** * Is the item checked? * @param item Original data item