-
Notifications
You must be signed in to change notification settings - Fork 66
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
Unsynchronized "expand" in TreeGrid #1627
Comments
See also vaadin/vaadin-grid-flow#476 |
This example reproduces the performance issues. |
I'm not able to reproduce the issue. I'm using With the following code, I click the first button to expand all items. While the grid is expanding, I click the second button which refreshes both the first item (already rendered), and the last item (still waiting to be loaded). Everything works as expected; there are no exceptions, the first item is updated immediately and the last one renders the updated value when loaded. Using @Route("treegrid-deep-tree")
public class TreeGridDeepTreePage extends Div {
private static final int DEPTH = 50;
private TreeGrid<Person> treeGrid;
private List<Person> items;
private TreeDataProvider<Person> dataProvider;
public TreeGridDeepTreePage() {
initializeDataProvider();
treeGrid = new TreeGrid<>();
treeGrid.setDataProvider(dataProvider);
treeGrid.setWidth("100%");
treeGrid.addHierarchyColumn(Person::getFirstName);
treeGrid.addComponentColumn(
person -> new NativeButton(person.getFirstName()));
NativeButton expandAll = new NativeButton("expand all",
e -> treeGrid.expandRecursively(items.subList(0, 1), DEPTH));
NativeButton refresh = new NativeButton("refresh", e -> {
Person first = items.get(0);
first.setFirstName("updated");
dataProvider.refreshItem(first);
Person last = items.get(items.size() - 1);
last.setFirstName("updated");
dataProvider.refreshItem(last);
});
add(treeGrid, expandAll, refresh);
}
private void initializeDataProvider() {
items = new PeopleGenerator().generatePeople(DEPTH);
TreeData<Person> data = new TreeData<>();
data.addRootItems(items.get(0));
IntStream.range(1, items.size()).forEach(i -> {
Person parent = items.get(i - 1);
Person item = items.get(i);
data.addItem(parent, item);
});
dataProvider = new TreeDataProvider<>(data);
}
} ( More info is needed to work on this issue, preferably a copy-pasteable code example which reproduces the bug. |
For the slowness, please refer to another issue: vaadin/vaadin-grid-flow#476 (reopened) Let's keep this issue just for these described bugs:
(although waiting for more information to reproduce the issue) |
Closing the issue as it's lacking instructions for reproduction. Will reopen if an example is provided. |
example802.zip |
My 5cents. I would add an API to define whether TreeGrid is EAGER or LAZY mode. Currently it is LAZY, and we should retain it as default. There are drawbacks from the lazyness, e.g. the recursive expansion, if you want the TreeGrid preopened. On the other hand current implementation is good when TreeGrid is not preopened and fully operated by user, not programmatically. EAGER mode would be better in applications where we want to preopen it fully or partially, provided that it is not super huge. On the other hand EAGER can make first render a bit slower. What is better is highly application specific, hence I would add the API to control this, so that developer who knows the application can decide what is good for him. |
Just to mention, the performance of the example app provided by @edler-san above was significantly improved by vaadin/vaadin-grid-flow#1084 even without this change |
The point that @TatuLund made above is IMO valid and I think it could be fixed in I would fix this at the same time when we make the item count query optional for hierarchical data ( |
Did a quick PoC of the TreeGrid eager fetch mode Lazy loading mode (slow network throttling on): treegrid-lazy.mp4Eager loading mode (slow network throttling on): treegrid-eager.mp4 |
@tomivirkki that's already a huge improvement... any chance, this will be implemented in Vaadin 14? |
@sirbris Yes, I don't see any blockers to backporting it to Vaadin 14 also. |
Why this ticket is still open? I am mainly pointing out that #2648 has been closed. |
Good point. No reason to keep this open anymore, closing |
The expansion of TreeGrids seems to be an asynchr. event sent to the client. When UI elements in the TreeGrid are updated (e.g. in a ComponentColumn that has icons) while the TreeGrid is still expanding on client-side, there are exceptions.
How to reproduce:
Results:
Expected Result:
Version used: Vaadin 14.0.5 (via vaadin-spring-boot-starter)
The text was updated successfully, but these errors were encountered: