diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt index 6042b0cca3..2d6d4dcffb 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt @@ -220,10 +220,9 @@ fun List.revealedItemCount(): Int { fun List.dropTemporarySections() { val bottomSection = this.find { it.boundary.area == ChatSectionArea.Bottom } if (bottomSection != null) { - val items = chatModel.chatItems.value - val itemsOutsideOfSection = items.size - 1 - bottomSection.boundary.maxIndex + val itemsOutsideOfSection = chatModel.chatItems.value.size - 1 - bottomSection.boundary.maxIndex chatModel.chatItems.removeRange(fromIndex = 0, toIndex = itemsOutsideOfSection + bottomSection.excessItemCount()) - chatModel.chatItemsSectionArea = mutableMapOf().also { it.putAll(items.associate { it.id to ChatSectionArea.Bottom }) } + chatModel.chatItemsSectionArea = mutableMapOf().also { it.putAll(chatModel.chatItems.value.associate { it.id to ChatSectionArea.Bottom }) } } }