Skip to content

Commit 2afd38f

Browse files
committed
chore(tree): revert treenode.children to querylist, add comment
1 parent 80012d1 commit 2afd38f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

projects/igniteui-angular/src/lib/tree/tree-node/tree-node.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ export class IgxTreeNodeComponent<T> extends ToggleAnimationPlayer implements Ig
8888
@HostBinding('class.igx-tree-node')
8989
public cssClass = 'igx-tree-node';
9090

91+
// TODO: Public API should expose array or null, not query list
9192
@ContentChildren(IGX_TREE_NODE_COMPONENT, { read: IGX_TREE_NODE_COMPONENT })
92-
private _children: QueryList<IgxTreeNode<any>>;
93+
public children: QueryList<IgxTreeNode<any>>;
9394

95+
// TODO: Refactor `children` to get `this.children.toArray() || null`
9496
/**
9597
* Return the child nodes of the node (if any)
9698
*
@@ -102,8 +104,8 @@ export class IgxTreeNodeComponent<T> extends ToggleAnimationPlayer implements Ig
102104
* const children: IgxTreeNode<any>[] = node.children;
103105
* ```
104106
*/
105-
public get children(): IgxTreeNode<any>[] {
106-
return this._children?.length ? this._children.toArray() : null;
107+
public get _children(): IgxTreeNode<any>[] {
108+
return this.children?.length ? this.children.toArray() : null;
107109
}
108110

109111
@ViewChild('defaultSelect', { read: TemplateRef, static: true })

projects/igniteui-angular/src/lib/tree/tree-selection.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class IgxTreeSelectionService {
251251
* Handle the selection state of a given node based the selection states of its direct children
252252
*/
253253
private handleNodeSelectionState(node: IgxTreeNode<any>) {
254-
const nodesArray = (node && node.children) ? node.children : [];
254+
const nodesArray = (node && node.children) ? node.children.toArray() : [];
255255
if (nodesArray.length) {
256256
if (nodesArray.every(n => this.nodesToBeSelected.has(n))) {
257257
this.nodesToBeSelected.add(node);

0 commit comments

Comments
 (0)