Skip to content

Commit

Permalink
remove subscription for expandAll and collapseAll
Browse files Browse the repository at this point in the history
  • Loading branch information
zarend committed Sep 26, 2023
1 parent ebfa0e6 commit fdf203b
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions src/cdk/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,12 @@ export class CdkTree<T, K = T>
this._nodeType,
// NB: the data is unused below, however we add it here to essentially
// trigger data rendering when expansion changes occur.
//
// TODO: remove debug code and comments
// Temporarily commenting this out to debug a test failure
//
// expansionModel.changed.pipe(
// startWith(null),
// tap(expansionChanges => {
// this._emitExpansionChanges(expansionChanges);
// }),
// ),
expansionModel.changed.pipe(
startWith(null),
tap(expansionChanges => {
this._emitExpansionChanges(expansionChanges);
}),
),
])
.pipe(
switchMap(([data, nodeType]) => {
Expand Down Expand Up @@ -647,11 +643,9 @@ export class CdkTree<T, K = T>
this.treeControl.expandAll();
} else if (this._expansionModel) {
const expansionModel = this._expansionModel;
this._getAllNodes()
.pipe(takeUntil(this._onDestroy))
.subscribe(children => {
expansionModel.select(...children.map(child => this._getExpansionKey(child)));
});
expansionModel.select(
...this._flattenedNodes.value.map(child => this._getExpansionKey(child)),
);
}
}

Expand All @@ -661,11 +655,9 @@ export class CdkTree<T, K = T>
this.treeControl.collapseAll();
} else if (this._expansionModel) {
const expansionModel = this._expansionModel;
this._getAllNodes()
.pipe(takeUntil(this._onDestroy))
.subscribe(children => {
expansionModel.deselect(...children.map(child => this._getExpansionKey(child)));
});
expansionModel.deselect(
...this._flattenedNodes.value.map(child => this._getExpansionKey(child)),
);
}
}

Expand Down

0 comments on commit fdf203b

Please sign in to comment.