From bdc08698c8de3a45f024e13a3156c1068a24d935 Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:12:06 +0300 Subject: [PATCH] multiplatform: reduce recompositions in ChatView while entering text (#2974) --- .../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 0a4b7a7fe..3370d34e7 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 @@ -425,11 +425,12 @@ fun ChatLayout( onComposed: () -> Unit, ) { val scope = rememberCoroutineScope() + val attachmentDisabled = remember { derivedStateOf { composeState.value.attachmentDisabled } } Box( Modifier .fillMaxWidth() .desktopOnExternalDrag( - enabled = !composeState.value.attachmentDisabled && rememberUpdatedState(chat.userCanSend).value, + enabled = !attachmentDisabled.value && rememberUpdatedState(chat.userCanSend).value, onFiles = { paths -> val uris = paths.map { URI.create(it) } val groups = uris.groupBy { isImage(it) }