fix: RecentBooksRow 中 bookUrl 为 null 时 key 重复导致崩溃
This commit is contained in:
1 file changed
+2
-1
@@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
@@ -994,7 +995,7 @@ private fun RecentBooksRow(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
items(books, key = { it.bookUrl.orEmpty() }) { book ->
|
itemsIndexed(books, key = { index, book -> "${book.bookUrl}_$index" }) { index, book ->
|
||||||
RecentHistoryBookCard(
|
RecentHistoryBookCard(
|
||||||
book = book,
|
book = book,
|
||||||
onClick = { book.bookUrl?.let(onBookClick) },
|
onClick = { book.bookUrl?.let(onBookClick) },
|
||||||
|
|||||||
Reference in new issue
Block a user