I have the very odd and annoying effect that a call to
treegrid.getDataProvider().refreshItem(node);
doesn’t update the visual as I would expect.
I have two views onto the same item (a tree and a form displaying data of individual nodes - very similar in fact to your Vaadin-CRM example from which I started except that I keep the form open after changing and saving the bean’s values). In order to update the left-hand side tree-view I trigger said refreshItem() call on that node after having updated the bean.
Trying to debug this I am by now logging the node’s state before calling refreshItem(node).
The bean’s values are absolutely correct, but the on-screen visuals are not updated accordingly by this call.
After collapsing the tree and expanding it again the correct values are shown, again proving that the change IS there, it’s just not updated/refreshed on-screen.
Any idea or hint what could cause this?
Furthermore, and maybe related, I lately (too) often run into this message while collapsing/expanding a subtree (I only noticed that since I kept repeatedly collapsing and expanding the tree due to the above update issue):
com.vaadin.flow.server.DefaultErrorHandler:
java.lang.IllegalArgumentException: Item 'IntermediateNode' not in the hierarchy
at com.vaadin.flow.data.provider.hierarchy.TreeData.getChildren(TreeData.java:349)
at com.vaadin.flow.data.provider.hierarchy.TreeDataProvider.getChildCount(TreeDataProvider.java:87)
at com.vaadin.flow.data.provider.hierarchy.HierarchyMapper.countChildItems(HierarchyMapper.java:357)
at com.vaadin.flow.data.provider.hierarchy.HierarchicalCommunicationController.flush(HierarchicalCommunicationController.java:116)
at com.vaadin.flow.data.provider.hierarchy.HierarchicalDataCommunicator.lambda$requestFlush$e15592a2$1(HierarchicalDataCommunicator.java:137)
at com.vaadin.flow.internal.StateTree.lambda$runExecutionsBeforeClientResponse$1(StateTree.java:368)
On screen I then get an error box reading:
Please notify the administrator.
Take note of any unsaved data, and click here or press ESC to continue.
Clicking onto the link reloads the data and everything seems OK again, so I have no clue why or what causes Vaadin to consider that item as not being part of the hierarchy. I guess I ran into some bug?
Any ideas on that?