Skip to content

Commit a6835ef

Browse files
authored
fix(cdk/tree): avoid breaking change in constructor (#29648)
In #29062 a new parameter was added to the `CdkTree` constructor which is a breaking change. These changes switch to using `inject` which allows us to avoid the breaking change. Fixes #29595.
1 parent 8b34fb7 commit a6835ef

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/cdk/tree/tree.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ export class CdkTree<T, K = T>
125125
OnDestroy,
126126
OnInit
127127
{
128+
private _dir = inject(Directionality);
129+
128130
/** Subject that emits when the component has been destroyed. */
129131
private readonly _onDestroy = new Subject<void>();
130132

@@ -265,7 +267,6 @@ export class CdkTree<T, K = T>
265267
constructor(
266268
private _differs: IterableDiffers,
267269
private _changeDetectorRef: ChangeDetectorRef,
268-
private _dir: Directionality,
269270
) {}
270271

271272
ngAfterContentInit() {

tools/public_api_guard/cdk/tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class CdkNestedTreeNode<T, K = T> extends CdkTreeNode<T, K> implements Af
7878

7979
// @public
8080
export class CdkTree<T, K = T> implements AfterContentChecked, AfterContentInit, AfterViewInit, CollectionViewer, OnDestroy, OnInit {
81-
constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality);
81+
constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef);
8282
childrenAccessor?: (dataNode: T) => T[] | Observable<T[]>;
8383
collapse(dataNode: T): void;
8484
collapseAll(): void;

0 commit comments

Comments
 (0)