Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LazyPagingItems.refresh has no effect #241

Open
mikedawson opened this issue Mar 26, 2024 · 0 comments
Open

LazyPagingItems.refresh has no effect #241

mikedawson opened this issue Mar 26, 2024 · 0 comments

Comments

@mikedawson
Copy link

mikedawson commented Mar 26, 2024

I have a PagingSource Factory in a ViewModel (Compose/Desktop) where parameters can change based on events (e.g. user changes sort order, search query, etc). I want to call LazyPagingItems.refresh() to trigger generating a new PagingSource and a call to RemoteMediator.load .

I am using this in compose:

val pager = remember(uiState.personList) {
    Pager(
        config = PagingConfig(pageSize = 20, enablePlaceholders = true, maxSize = 200),
        pagingSourceFactory = {
            Napier.d("PersonListScreen: Invoke pagingSourceFactory")
            uiState.personList()
        },
        remoteMediator = DoorRepositoryRemoteMediator(uiState.personList),
    )
}

val lazyPagingItems = pager.flow.collectAsLazyPagingItems()

LaunchedEffect(listRefreshCommand) {
    listRefreshCommand.collect {
        Napier.d("PersonListScreen: refresh lazypagingitems")
        lazyPagingItems.refresh()
    }
}

I got a log line that shows Refresh signal received (probably from PagingDataPresenter.kt). However there is no invocation of the PagingSourceFactory and no call to remotemediator.load.

This is using version 3.3.0-alpha02-0.5.1 . The project can be found here - example file PersonListScreen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant