angular / angular/components

feat(cdk/tree): expose getDescendants method of CdkTree just like the deprecated TreeControl class

Open
#29,609 1 comment 7 reactions 0 assignees View on GitHub
area: cdk/tree feature P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Feature Description

Before v18.2, `TreeControl ` was used to control the whole tree and it exposes the `getDescendants ` publicly. After v18.2, the `getDescendants` was migrated to `CdkTree` ([source](https://github.com/angular/components/blob/1abb484aa72177a748eecdf9b850cc1c07d1a42b/src/cdk/tree/tree.ts#L889-L890)) but it was made private. Hence, all code that depends on `getDescendants` function will break and have no migration path for `TreeControl` users.

### Use Case

Allows developers to get all children and grandchildren without writing his own code or duplicating unnecessary code.

Contributor guide

Open the contributing guide

Research direction

Start in src/cdk/tree/tree.ts at the migrated getDescendants implementation referenced in the issue. Compare its current visibility with the deprecated TreeControl API and inspect nearby tree tests or public API conventions. Done means CdkTree exposes getDescendants for callers who previously used TreeControl.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.