From 089e5f6ec15e620095e8c06416b3910bee33aa46 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:05:42 +0700 Subject: [PATCH] fix stale chatInfo --- .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 643227b01e..735d96326a 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -1034,6 +1034,7 @@ fun BoxScope.ChatItemsList( } } } + val chatInfoUpdated = rememberUpdatedState(chatInfo) val scrollToItem: State<(Long) -> Unit> = remember { mutableStateOf({ itemId: Long -> val index = sections.value.chatItemPosition(itemId) @@ -1057,7 +1058,7 @@ fun BoxScope.ChatItemsList( val chatSectionLoader = ChatSectionLoader(0, ChatSectionArea.Destination) apiLoadMessages( rhId = remoteHostId, - chatInfo = chatInfo, + chatInfo = chatInfoUpdated.value, chatModel = chatModel, itemId = itemId, search = "",