Dynamic nested tree - children data loaded twice #18682
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
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 toNestedTreeControl
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), thengetChildren
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!
The text was updated successfully, but these errors were encountered: