Refresh in paging 3 library when using RxJava
I had similar problem with my code and I found this issue which helped me.
The paging source factory lambda of the Pager must always return a new instance of the source. In your case it's always returning the instance you created in your init()
method.
Try to change it to something like:
Pager<Integer, ExpensesModel> pager = new Pager<Integer, ExpensesModel>(
new PagingConfig(10,
10,
false,
10,
100),
() -> {new ExpensePagingSource(feDataService)});
So instead of
val pagingSource = PagingSource()
return Pager() {
pagingSource
}.flow
Use this
return Pager() {
PagingSource()
}.flow
Basically it helps store the reference of paging resource which is later used by adapter to call invalidate on it when you call refresh().