@@ -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 ( ) {
@@ -1004,7 +1007,11 @@ export class CdkTree<T, K = T>
10041007 * This will still traverse all nested children in order to build up our internal data
10051008 * models, but will not include them in the returned array.
10061009 */
1007- private _flattenNestedNodesWithExpansion ( nodes : readonly T [ ] , selection : readonly K [ ] , level = 0 ) : Observable < T [ ] > {
1010+ private _flattenNestedNodesWithExpansion (
1011+ nodes : readonly T [ ] ,
1012+ selection : readonly K [ ] ,
1013+ level = 0 ,
1014+ ) : Observable < T [ ] > {
10081015 const childrenAccessor = this . _getChildrenAccessor ( ) ;
10091016 // If we're using a level accessor, we don't need to flatten anything.
10101017 if ( ! childrenAccessor ) {
@@ -1037,7 +1044,7 @@ export class CdkTree<T, K = T>
10371044 return observableOf ( [ ] ) ;
10381045 }
10391046 return this . _flattenNestedNodesWithExpansion ( childNodes , selection , level + 1 ) . pipe (
1040- map ( nestedNodes => selection . includes ( parentKey ) ? nestedNodes : [ ] ) ,
1047+ map ( nestedNodes => ( selection . includes ( parentKey ) ? nestedNodes : [ ] ) ) ,
10411048 ) ;
10421049 } ) ,
10431050 ) ,
0 commit comments