From 494724de01650aaaf777f44d279e4a1e20428327 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:09:54 +0700 Subject: [PATCH] one more --- .../kotlin/chat/simplex/common/views/chat/ChatSections.kt | 2 +- .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 3fc87b4ced..6042b0cca3 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 @@ -236,7 +236,7 @@ fun landingSectionToArea(chatLandingSection: ChatLandingSection) = when (chatLan ChatLandingSection.Unread -> ChatSectionArea.Current } -suspend fun apiLoadBottomSection(chatInfo: ChatInfo, chatModel: ChatModel, rhId: Long?) { +suspend fun apiLoadBottomSection(chatInfo: ChatInfo, rhId: Long?) { val chat = chatController.apiGetChat(rh = rhId, type = chatInfo.chatType, id = chatInfo.apiId) if (chatModel.chatId.value != chatInfo.id || chat == null) return withContext(Dispatchers.Main) { 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 735d96326a..4b055b80bf 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 @@ -1002,6 +1002,7 @@ fun BoxScope.ChatItemsList( val topPaddingToContentPx = rememberUpdatedState(with(LocalDensity.current) { topPaddingToContent().roundToPx() }) val maxHeight = remember { derivedStateOf { listState.layoutInfo.viewportEndOffset - topPaddingToContentPx.value } } + val chatInfoUpdated = rememberUpdatedState(chatInfo) LaunchedEffect(Unit) { launch { @@ -1023,7 +1024,7 @@ fun BoxScope.ChatItemsList( withBGApi { scrollAdjustmentEnabled.value = false try { - apiLoadBottomSection(chatInfo, chatModel, remoteHostId) + apiLoadBottomSection(chatInfoUpdated.value, remoteHostId) } finally { delay(600) scrollAdjustmentEnabled.value = true @@ -1034,7 +1035,6 @@ fun BoxScope.ChatItemsList( } } } - val chatInfoUpdated = rememberUpdatedState(chatInfo) val scrollToItem: State<(Long) -> Unit> = remember { mutableStateOf({ itemId: Long -> val index = sections.value.chatItemPosition(itemId)