I'm using paging-compose library to load paginated data from server using remote mediator (backed by local room database). Is there any way to manually refresh mediator data in case of swipe to refresh?
Calling refresh() method on LazyPagingItems should work for swipe to refresh (UI driven event) as mention in documentation LazyPagingItems.refresh()
Refresh the data presented by this
LazyPagingItems.
refreshtriggers the creation of a newPagingDatawith a new instance ofPagingSourceto represent an updated snapshot of the backing dataset. If aRemoteMediatoris set, calling refresh will also trigger a call toRemoteMediator.loadwith REFRESH to allowRemoteMediatorto check for updates to the dataset backingPagingSource.
Note: This API is intended for UI-driven refresh signals, such as swipe-to-refresh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With