feat: Enhance message key uniqueness in ChatDetailScreen to prevent empty IDs
This commit is contained in:
@@ -794,7 +794,10 @@ fun ChatDetailScreen(
|
||||
) {
|
||||
// Reversed layout: item 0 = самое новое сообщение (внизу экрана)
|
||||
// messagesWithDates уже отсортирован новые->старые
|
||||
itemsIndexed(messagesWithDates, key = { _, item -> item.first.id }) {
|
||||
// Используем id + timestamp для уникальности ключа (защита от пустых id)
|
||||
itemsIndexed(messagesWithDates, key = { index, item ->
|
||||
item.first.id.ifEmpty { "msg_${item.first.timestamp.time}_$index" }
|
||||
}) {
|
||||
index,
|
||||
(message, showDate) ->
|
||||
// Определяем, показывать ли хвостик (последнее сообщение в группе)
|
||||
|
||||
Reference in New Issue
Block a user