components
components copied to clipboard
bug(cdk/tree): Breaking change in CdkTree from added constructor parameter
trafficstars
Is this a regression?
- [X] Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
~18.1
Description
Hi, I hope this is not too pedantic:
A change in the constructor parameters of CdkTree introduced a breaking change in 5a6c68e via #29062 (released in 18.2.0).
This breaks downstream code where components extend CdkTree and implement a custom constructor.
In the same commit, another injection was added with the inject function, so I would assume the same could have been done for Directionality.
Reproduction
Example Breaking Code (only class declaration and constructor for brevity)
class MyTree<T> extends CdkTree<T> {
constructor(
_differs: IterableDiffers,
_cdr: ChangeDetectorRef,
private something: SomeProvider,
) {
super(_wrapperDiffers, _cdr);
}
}
Expected Behavior
Example Code still works
Actual Behavior
Example Code breaks, because CdkTree has an additional constructor injection with _dir: Direction
Environment
- Angular: 18.2.0
- CDK/Material: 18.2.0