https://github.com/evant/paging-compose-refresh-issue
https://github.com/evant/paging-compose-refresh-issue
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/evant/paging-compose-refresh-issue
- Owner: evant
- Created: 2024-03-18T22:10:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T22:38:51.000Z (about 2 years ago)
- Last Synced: 2025-01-05T09:43:57.266Z (over 1 year ago)
- Language: Kotlin
- Size: 98.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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()
}
```