question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async load is duplicated after updating tree model

See original GitHub issue

Hi there, so my tree has async config with getChildren with promise and every time I update the tree model by creating a new array this.nodes = [newNode, ...this.nodes]; or this.tree.treeModel.update(). The async now is call twice and make 2 api requests with same URL when click to expand the nodes. If I update the tree model again it will increase the async call to 3. My code base on:

  • Tree component version 7
  • Angular 4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
sergeo2commented, Jan 2, 2018

I found the same issue, using Angular 5, and tree component version 7.0.1. After some investigation - looks like VirtualRoot stay alive after new nodes re-render. Only fix i able to do right now - check if virtual root is correct on getChildren call:

@ViewChild("tree") public tree: TreeComponent

getChildren(node: ITreeNode): any {
    if (node.isDescendantOf(this.tree.treeModel.virtualRoot)) { 
      //DO async call to retrieve children
    }
 }

That is only dirty workaround to prevent duplicated calls to API, but doesn’t actually fix initial issue. Any tries to kill virtualroot or clean up data before prior was unsuccessful. So would be nice to see any valid Solution.

0reactions
tobiasengelhardtcommented, Jul 31, 2020

Closing this issue due to inactivity. Please open a new issue if the problem still exists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async load is duplicated after updating tree model #517 - GitHub
Hi there, so my tree has async config with getChildren with promise and every time I update the tree model by creating a...
Read more >
AngularTreeComponent: treeModel.update() works async ...
I neeed to replace some data on the tree, then run treemodel.update() and after that select a node. Tree is already rendered at...
Read more >
Kendo Load On Demand Treelist showing duplicate records ...
I am using Kendo Treelist ie: Load on Demand in our application. ... When I try to apply filter to my columns, the...
Read more >
How to avoid Angular injectable instances duplication
In this article we'll explore when and why Angular creates two instances of the same service and what solutions exist to ensure a...
Read more >
42 Invokie an Asynchronous Service from a SOA Composite
When to implement: A SOA composite application needs to invoke an asynchronous service such as an Oracle ADF service or another SOA composite...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found