fix: RecentBooksRow 中 bookUrl 为 null 时 key 重复导致崩溃

This commit is contained in:
HapeLee
2026-06-30 02:26:05 +08:00
parent c10714f2f7
commit 7182b6e0e1
@@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.rememberScrollState
@@ -994,7 +995,7 @@ private fun RecentBooksRow(
modifier = modifier,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
items(books, key = { it.bookUrl.orEmpty() }) { book ->
itemsIndexed(books, key = { index, book -> "${book.bookUrl}_$index" }) { index, book ->
RecentHistoryBookCard(
book = book,
onClick = { book.bookUrl?.let(onBookClick) },