Skip to content

Async loading child with large dataset #463

Closed

Description

@anhvupham

Async loading child with large dataset doesn't always work, it doesn't works well with nodes that were rendered at the 1st load.

Steps to produce:
_ Create tree with virtual scroll and large dataset (10k) => tree is rendered fast and good when page load.
_ Create getChildren option which return promise with 10k nodes.
_ Click on nodes that were rendered at the 1st load => observe the delay time (~12 secs)
_ Scroll down and click on nodes that are down below => node is expanded quickly without delay.

Activity

  1. markammay commented on Nov 1, 2017

    @markammay

    Hello I am testing Angular Tree for our project and I think we're having the same issue.

    I have a parent tree, let's say 30 items. My height only shows the first 10 items for example. If I scroll down to item 30 and click that folder to expand a large tree of 5k-10k items it takes roughly 3 seconds. However if I try to open item 1 folder and expand a large tree of 5k-10k it will take 10-11seconds to load. Big difference!

    Ask: may we fix it so it also loads fast without having to scroll to item 30ish? within the viewport it is slow to render the 5k-10k

    btw I'm doing this:

    • "useVirtualScroll: true, nodeHeight: 22"
    • setting folder wrapper height to 100px via css (only for testing, it could be 500px or more)
    • this.tree.treeModel.virtualScroll.setViewport(this.folderTree.nativeElement);

    I would like to know if this may be fixed... or a hint on how we could fix it? This issue is the only thing holding us back from using Angular Tree but it's the only issue we see. Other than that, we love it!

  2. adamkleingit commented on Nov 4, 2017

    @adamkleingit
    Contributor

    Just verified - so weird. Inspecting it.
    I would really love some help debugging this @markammay @anhvupham
    Thanks

  3. jacmgh commented on Dec 1, 2018

    @jacmgh

    Anything new about this issue? It would be great if this one was solved. Other than that very nice and useful lib.

  4. added 2 commits that reference this issue on Dec 8, 2018
  5. added a commit that references this issue on Dec 25, 2018
  6. adamkleingit commented on Dec 25, 2018

    @adamkleingit
    Contributor

    Merged and published in 8.1.0

  7. Novkirishki commented on Nov 13, 2020

    @Novkirishki
    Contributor

    Hello, this issue is still reproducible when the nodeHeight tree option is INodeHeightFn and not a number. The merged workaround handles only the case when nodeHeight is a number.

    There is also another issue with this workaround - when doing the following calculation:
    const renderedNodesMaxLength = (Y_OFFSET * 2 + this.viewportHeight) / nodeHeight;
    the renderedNodesMaxLength is not an integer number (13.9 for example).

    This may result in inproper invalidation of the collection of nodes:
    if (lastIndex - firstIndex > renderedNodesMaxLength) { return []; }
    LastIndex can be 28, and firstIndex can be 14, which is a valid scenario, but because renderedNodesMaxLength is not ceiled an empty array will be returned. The result is an empty screen with no rendered tree nodes.

    Both issues described are easily reproducible in the example app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions