After DataSource.Invalidate() new PagedList has only one page
I want to share my research in case anybody is interested:
- Issue ("lack of feature") is known, at least I've found the couple related discussions on official tracker one two
- If you are using
PositionalDataSource
orItemKeyedDataSource
you should dig into the direction ofrequestedStartPosition/requestedInitialKey
from initial params as this answer says. I didn't have much time to build the whole solution but those params are indeed different for initial load after invalidation
About my case : PageKeyedDataSource
. Here you can read that there is no similar to requestedInitialKey
params in this type of data source. Still, I found a solution which fits me, very simple, although, feels like a dirty trick:
When loadInitial()
is called after invalidate()
in-memory cache returns all already loaded pages instead of just first one.
At first I was worry that something will break if, for example, requestedLoadSize
is 5 but the result is 50 items list but turns out it's just a hint and it can be ignored. Just don't forget to pass nextPageKey
which corresponds to the last cached page and not the first one.
Hope it will help