multiplatform: reduce recompositions in ChatView while entering text (#2974)

This commit is contained in:
Stanislav Dmitrenko 2023-08-25 12:12:06 +03:00 committed by GitHub
parent 7f894abbad
commit bdc08698c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) }