How can I re-apply the filters on a grid when I reload the data

I have a button that creates a new item in my grid. As a result I just reload the entire grid because I may as well just reload the grid from the database in case another user has also performed some other action. The problem is that I have filters set on the grid and when I reload the grid the filters are no longer applied. Therefore how can I manually tell the grid (ListDataProvider, etc.) to also re-apply the filters to the items in the grid?

The only way I could find to do this was:

SerializablePredicate filter = ((ListDataProvider)grid.getDataProvider()).getFilter();
grid.setItems(updatedItems);
((ListDataProvider)grid.getDataProvider()).setFilter(filter);