vaadin / vaadin/framework

TreeGrid loads all data from the data provider when scroll position changes

Open
#10,317 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

For fetching hierarchical data (for TreeGrid) the HierarchyMapper is used. Method

public Stream<T> fetchItems(Range range)

is invoked every time the current scroll position of the Tree(Grid) changes. What happens is that the hierarchy is retrieved, and then in memory stream operations are done to skip to and limit the correct amount of data shown like this:

return getHierarchy(null).skip(range.getStart()).limit(range.length());

This will effectively for every scroll position change load ALL data from the backing data provider. Needless to say this will slow down any lazy loading intended hierarchical grids to crawl if there's more than trivial amount of data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HierarchyMapper.fetchItems(Range range) and trace its getHierarchy(null) call. Reproduce scrolling with a lazy-loading hierarchical data provider and inspect whether the full hierarchy is loaded before skip and limit. Done means range fetching no longer loads all backing data on each scroll position change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.