Skip to content

Commit e254baa

Browse files
committed
fix(cdk/tree): formatting
1 parent b5cc788 commit e254baa

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

src/cdk/tree/tree.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,6 @@ class NestedChildrenExpansionTest {
21832183
data[0].children = children;
21842184

21852185
this.dataSource = data;
2186-
this.allNodes = [...data, ...children, ... nestedChildren];
2186+
this.allNodes = [...data, ...children, ...nestedChildren];
21872187
}
21882188
}

src/cdk/tree/tree.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,21 @@ export class CdkTree<T, K = T>
273273

274274
constructor(...args: unknown[]);
275275
constructor() {
276-
effect(onCleanup => {
277-
const data = this._data();
278-
const nodeType = this._nodeType();
279-
const expandedKeys = this._selection();
280-
281-
const sub = this._getRenderData(data, nodeType, expandedKeys).subscribe(renderData => {
282-
this._renderDataChanges(renderData);
283-
});
284-
onCleanup(() => {
285-
sub.unsubscribe();
286-
});
287-
}, {allowSignalWrites: true});
276+
effect(
277+
onCleanup => {
278+
const data = this._data();
279+
const nodeType = this._nodeType();
280+
const expandedKeys = this._selection();
281+
282+
const sub = this._getRenderData(data, nodeType, expandedKeys).subscribe(renderData => {
283+
this._renderDataChanges(renderData);
284+
});
285+
onCleanup(() => {
286+
sub.unsubscribe();
287+
});
288+
},
289+
{allowSignalWrites: true},
290+
);
288291
}
289292

290293
ngAfterContentInit() {
@@ -1010,7 +1013,11 @@ export class CdkTree<T, K = T>
10101013
* This will still traverse all nested children in order to build up our internal data
10111014
* models, but will not include them in the returned array.
10121015
*/
1013-
private _flattenNestedNodesWithExpansion(nodes: readonly T[], selection: readonly K[], level = 0): Observable<T[]> {
1016+
private _flattenNestedNodesWithExpansion(
1017+
nodes: readonly T[],
1018+
selection: readonly K[],
1019+
level = 0,
1020+
): Observable<T[]> {
10141021
const childrenAccessor = this._getChildrenAccessor();
10151022
// If we're using a level accessor, we don't need to flatten anything.
10161023
if (!childrenAccessor) {
@@ -1043,7 +1050,7 @@ export class CdkTree<T, K = T>
10431050
return observableOf([]);
10441051
}
10451052
return this._flattenNestedNodesWithExpansion(childNodes, selection, level + 1).pipe(
1046-
map(nestedNodes => selection.includes(parentKey) ? nestedNodes : []),
1053+
map(nestedNodes => (selection.includes(parentKey) ? nestedNodes : [])),
10471054
);
10481055
}),
10491056
),

0 commit comments

Comments
 (0)