From 2477f77fb8d6fa4ad0811aed42662e101ff1bdc7 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Tue, 14 Jul 2026 23:37:37 +0200 Subject: [PATCH] Bug fix on chat creation --- .../ui/view/model/ChatRoomMessagingViewModel.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/ChatRoomMessagingViewModel.kt b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/ChatRoomMessagingViewModel.kt index 2b620f75..fc0f036b 100644 --- a/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/ChatRoomMessagingViewModel.kt +++ b/composeApp/src/commonMain/kotlin/at/torch/compose/ui/view/model/ChatRoomMessagingViewModel.kt @@ -129,14 +129,17 @@ class ChatRoomMessagingViewModel( peerKeyPackage = keyPackageEvent, ) - onNavigateToChat.invoke( - ChatRoomMessagingRoute( - activeUserPublicKey = activeUserPublicKey, - chatRoomId = chatRoomId, - relayHint = relayHint + viewModelScope.launch(Dispatchers.Main) { + onNavigateToChat.invoke( + ChatRoomMessagingRoute( + activeUserPublicKey = activeUserPublicKey, + chatRoomId = chatRoomId, + relayHint = relayHint + ) ) - ) + } } catch (e: Throwable) { + logger.e("Failed to create chat", e) chatRoomMessagingUIState = ChatRoomMessagingUIState.Error("Failed to create chat") } }