Skip to content

Commit 718cee0

Browse files
crisbetotinayuangao
authored andcommitted
refactor(tree): use destroy cleanup logic from base class (#10740)
Uses the `ngOnDestroy` logic from the `CdkTreeNode` rather than re-implementing it in the `CdkNestedTreeNode`. This is less prone to errors in the future, if we decide to introduce more cleanup logic inside the base class.
1 parent f023579 commit 718cee0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/cdk/tree/nested-node.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ export class CdkNestedTreeNode<T> extends CdkTreeNode<T> implements AfterContent
7979
this.updateChildrenNodes();
8080
});
8181
this.nodeOutlet.changes.pipe(takeUntil(this._destroyed))
82-
.subscribe((_) => this.updateChildrenNodes());
82+
.subscribe(() => this.updateChildrenNodes());
8383
}
8484

8585
ngOnDestroy() {
8686
this._clear();
87-
this._destroyed.next();
88-
this._destroyed.complete();
87+
super.ngOnDestroy();
8988
}
9089

9190
/** Add children dataNodes to the NodeOutlet */

0 commit comments

Comments
 (0)