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

Dynamic nested tree - children data loaded twice #18682

Open
kctang opened this issue Mar 3, 2020 · 0 comments
Open

Dynamic nested tree - children data loaded twice #18682

kctang opened this issue Mar 3, 2020 · 0 comments
Labels
area: material/tree needs investigation A member of the team needs to do further investigation to determine the root cause P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@kctang
Copy link

kctang commented Mar 3, 2020

I hit this issue when trying to implement a nested tree using Angular Material where nodes can dynamically load children nodes (when user expands the tree control).

Reproduction

See a demo of the issue here.

I asked as a question on SO here.

Expected Behavior

In the demo, nodes with nested children returns an observable of nodes[]. I expect this to be called once (i.e. when user expands the node).

Actual Behavior

When user expands the node, the observable is called twice (i.e. loading data twice). However, end result 'seems to work' - just not ideal as it loads data twice.

Additional Comments

I expect getChildren function passed to NestedTreeControl to be called once per node but i think it can be called twice.

Based on my local testing, if I remove <mat-nested-tree-node> (in green), then getChildren is called once per node. I think it has something to do with this but I do not understand the internals of this tree component enough to say more.

Hope someone can help or point me to the right direction. Cheers!

image

@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@crisbeto crisbeto added needs investigation A member of the team needs to do further investigation to determine the root cause P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/tree needs investigation A member of the team needs to do further investigation to determine the root cause 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

4 participants