An open API service indexing awesome lists of open source software.

https://github.com/evant/paging-compose-refresh-issue


https://github.com/evant/paging-compose-refresh-issue

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# Paging refresh issue

A sample repo showing off paging `refresh()` calls being dropped.

If I call `refresh()` from a `LaunchedEffect` on the current page, the call is dropped instead of
making it to the `RemoteMediator`.

```
val list = pagingFlow.collectAsLazyPagingItems()
LaunchedEffect(Unit) {
// expected: this should trigger a refresh of the remote mediator every
// time you navigate back to this page
Log.d("TEST", "refresh called")
list.refresh()
}
```

Looking at the implementation, this appears to be because there's a tick after collection where
a `uiRecfeiver` is not set.

```
public abstract class PagingDataDiffer...

public suspend fun collectFrom(pagingData: PagingData) {
collectFromRunner.runInIsolation {
uiReceiver = pagingData.uiReceiver
...

public fun refresh() {
log(DEBUG) { "Refresh signal received" }
uiReceiver?.refresh()
}

```