I have a Grid with an AbstractBackEndDataProvider. The provider reads data from a database and return new instances for every call. I have added a ValueProvider so that an instance can be mapped by database id to an existing item in the DataProvider.
When I call dataProvider.refreshAll() there will be a call to the fetchFromBackEnd() metod that, in our case, will fetch data from the database. The data is “matched” with the keyMapper in the DataProvider and therefore the new data from the database will be ignored.
The documentation say that we should use refreshItem(obj) to prevent “stale” items.
https://vaadin.com/docs/v10/flow/binding-data/tutorial-flow-data-provider.html#lazy-refresh
“For example Spring Data gives you new instances with every request, and making changes to the repository will make old instances of the same object “stale”. In these cases you should inform any interested component by calling dataProvider.refreshItem(newInstance)”
But what if another application is updating the database and I want to refresh the grid in my application. That wont work with refreshAll() and using refreshItem(obj) feels not like the right solution. See the attached image.
Is there a way to force a complete refresh of the DataProvider?