DataProvider issues on row edit/key change

I have a problem in a Grid with a DataProvider backing it (Spring Data based), when I edit a row in such a way that the key changes (that is, the equals and hashcode method will no longer align with the previous version of the item).

After saving the revised item, I call refreshAll on the DataProvider.

However, from this point on the DataProvider has unusual behavior - it seems to have a ghost copy of the row somewhere internally, presumably with invalid data. I get an exception when selecting the row and a componentColumn method does not seem to get called for the row that was changed.

I get around this by simply creating a new DataProvider rather than calling refreshAll. This seems functionally acceptable, since the most expensive operation by far are the queries to the database, which have to be done anyway. However, it seems like there should be a more elegant solution.

Vaadin version is 14.1.17

Any ideas?