compose: SearchScreen: Use random UUID as keys
Server can send same package again as we are filtering through different bundles. Keys are basically packageName's hashcode, so they can end up as being similar and crash the app. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -44,7 +44,8 @@ kotlin {
|
|||||||
"androidx.compose.material3.ExperimentalMaterial3ExpressiveApi",
|
"androidx.compose.material3.ExperimentalMaterial3ExpressiveApi",
|
||||||
"androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
"androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
||||||
"androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi",
|
"androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi",
|
||||||
"coil3.annotation.ExperimentalCoilApi"
|
"coil3.annotation.ExperimentalCoilApi",
|
||||||
|
"kotlin.uuid.ExperimentalUuidApi"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ import androidx.paging.LoadState
|
|||||||
import androidx.paging.PagingData
|
import androidx.paging.PagingData
|
||||||
import androidx.paging.compose.LazyPagingItems
|
import androidx.paging.compose.LazyPagingItems
|
||||||
import androidx.paging.compose.collectAsLazyPagingItems
|
import androidx.paging.compose.collectAsLazyPagingItems
|
||||||
import androidx.paging.compose.itemKey
|
|
||||||
import com.aurora.extensions.emptyPagingItems
|
import com.aurora.extensions.emptyPagingItems
|
||||||
import com.aurora.gplayapi.SearchSuggestEntry
|
import com.aurora.gplayapi.SearchSuggestEntry
|
||||||
import com.aurora.gplayapi.data.models.App
|
import com.aurora.gplayapi.data.models.App
|
||||||
@@ -82,6 +81,7 @@ import kotlinx.coroutines.android.awaitFrame
|
|||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlin.uuid.Uuid
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchScreen(onNavigateUp: () -> Unit, viewModel: SearchViewModel = hiltViewModel()) {
|
fun SearchScreen(onNavigateUp: () -> Unit, viewModel: SearchViewModel = hiltViewModel()) {
|
||||||
@@ -257,7 +257,7 @@ private fun ScreenContent(
|
|||||||
LazyColumn {
|
LazyColumn {
|
||||||
items(
|
items(
|
||||||
count = results.itemCount,
|
count = results.itemCount,
|
||||||
key = results.itemKey { it.id }
|
key = { Uuid.random().toString() }
|
||||||
) { index ->
|
) { index ->
|
||||||
results[index]?.let { app ->
|
results[index]?.let { app ->
|
||||||
LargeAppListItem(
|
LargeAppListItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user