Skip to content

bug(cdk/tree): Breaking change in CdkTree from added constructor parameter #29595

@cuddlecake

Description

@cuddlecake

Is this a regression?

  • 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

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/tree

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions