Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(MatTree): expandAll() only expand the first level #29865

Open
1 task done
robmv opened this issue Oct 11, 2024 · 0 comments
Open
1 task done

bug(MatTree): expandAll() only expand the first level #29865

robmv opened this issue Oct 11, 2024 · 0 comments
Labels
area: material/tree P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@robmv
Copy link

robmv commented Oct 11, 2024

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

17.x

Description

The method expandAll() of MatTree expands only the first level of a deeply nested tree. On deprecated MatTreeControl, the same method was able to expand the entire tree without problems.

Note: the deprecated control had an advantage that the expansion state could be manipulated before even the view was initialized, but that is another topic.

WORKAROUND:

this.dataSource.forEach(node => this.tree.expandDescendants(node));

Reproduction

StackBlitz link:

Steps to reproduce:

  1. Open the demos.
  2. The tree is partially expanded
  3. Edit the demo and enable the workaround on the ngAfterViewInit callback.
  4. The tree is now fully expanded.

Expected Behavior

MatTree's expandAll() should expand all nodes.

Actual Behavior

Only the first level nodes are expanded.

Environment

  • Angular: 18.2.8
  • CDK/Material: 18.2.8
  • Browser(s): Firefox, Chromium
  • Operating System (e.g. Windows, macOS, Ubuntu): Linux (Fedora)
@robmv robmv added the needs triage This issue needs to be triaged by the team label Oct 11, 2024
@wagnermaciel wagnermaciel added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/tree and removed needs triage This issue needs to be triaged by the team labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/tree P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

2 participants