Fix loading screen not appearing when changing query in browser screen

Fixes #1438
Closes #1441
This commit is contained in:
AntsyLich
2024-11-20 17:44:52 +06:00
parent dcddac5daa
commit 9aef08c333
5 changed files with 28 additions and 8 deletions

View File

@ -42,5 +42,7 @@ dependencies {
implementation(compose.ui.tooling.preview)
implementation(compose.ui.util)
implementation(androidx.paging.runtime)
implementation(androidx.paging.compose)
implementation(kotlinx.immutables)
}

View File

@ -0,0 +1,16 @@
package mihon.presentation.core.util
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.paging.PagingData
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
@Composable
fun <T: Any> StateFlow<Flow<PagingData<T>>>.collectAsLazyPagingItems(): LazyPagingItems<T> {
val flow by collectAsState()
return flow.collectAsLazyPagingItems()
}