Vaadin TreeGrid disappearing items or there was null items during update V8

(Ab)using the TreeGrid for navigation purposes we use an InMemoryHierarchicalDataProvider using a List auf NavigationEntry that contain a link title, count of contained items on the linked page.

Column<NavigationEntry, String> colTitle = navigation.addColumn(item -> item.getTitle());
Column<NavigationEntry, String> colCount = navigation.addColumn(item -> item.getCount() == null ? "" : Strings
                .toHumanReadableString(item.getCount()));

Vaadin Version: 8.1.0.alpha6
Browser: Firefox 51.0.1

TreeGrid Navigation sample:

A
B
C

  • C1
  • C2
    D
  • D1
  • D2
  • D3

In case the grid is used heavily some entries D, D1, D2, D3 can disappear.

When also updating the navElement in the code with new item counts.InMemoryHierarchicalDataProvider.refreshItem(navElement) it is even possible to cause an Exception:

Error: For requested rows Range [10..14[, there was null items for indexes 0, 1, 2, 3
Source: com.vaadin.ui.TreeGrid
Stack trace:
java.lang.IllegalStateException: For requested rows Range [10..14[, there was null items for indexes 0, 1, 2, 3
at com.vaadin.data.provider.HierarchicalDataCommunicator.verifyNoNullItems(HierarchicalDataCommunicator.java:209)
at com.vaadin.data.provider.HierarchicalDataCommunicator.doPushRows(HierarchicalDataCommunicator.java:184)
at com.vaadin.data.provider.HierarchicalDataCommunicator.loadRequestedRows(HierarchicalDataCommunicator.java:156)
at com.vaadin.data.provider.HierarchicalDataCommunicator.sendDataToClient(HierarchicalDataCommunicator.java:107)
at com.vaadin.data.provider.DataCommunicator.beforeClientResponse(DataCommunicator.java:304)
at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:110)
at com.vaadin.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:124)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:92)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1464)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

Thanks for the abuse. Forwarded this to the team. They may not follow this section of Forum as this was intented to discuss the WebComponent set of Vaadin Elements, not Framework UI components which has it’s own subcategory inside Framework section. But anyway, thanks for the abuse Michael!

Juha

Thank you Juha - if necessary the post can be moved to Framework UI. I just missed that category somehow …
Is there anything better suited for a vertical navigation element in upcoming releases ?

As for the affected browsers I did a little bit of stress testing yesterday.
Firefox seems to show most issues
With Chrome it is still possible to reproduce some
Internet Explorer takes most time switching between views and I was unable to reproduce any exceptions

The strangest issue inside the navigation with Firefox looked like this:

A
B
C

  • C1
    – D1
    – D2
    – D3
  • C2
    D
Error: Could not find expanded node for index 13, node was not collapsed
Source: com.vaadin.ui.TreeGrid
Stack trace:
java.lang.IllegalStateException: Could not find expanded node for index 13, node was not collapsed
at com.vaadin.data.provider.HierarchyMapper.collapse(HierarchyMapper.java:285)
at com.vaadin.data.provider.HierarchicalDataCommunicator.doCollapse(HierarchicalDataCommunicator.java:375)
at com.vaadin.ui.TreeGrid$1.setNodeCollapsed(TreeGrid.java:224)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1464)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)