From 93f285f02fdedb09aa596d3ba1231f703d93b2c2 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sun, 24 May 2026 08:30:04 +0700 Subject: [PATCH] . --- .../androidMain/kotlin/su/reya/coop/screens/HomeScreen.kt | 4 +++- .../src/commonMain/kotlin/su/reya/coop/NostrViewModel.kt | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/su/reya/coop/screens/HomeScreen.kt b/composeApp/src/androidMain/kotlin/su/reya/coop/screens/HomeScreen.kt index bb840a7..d1c0d03 100644 --- a/composeApp/src/androidMain/kotlin/su/reya/coop/screens/HomeScreen.kt +++ b/composeApp/src/androidMain/kotlin/su/reya/coop/screens/HomeScreen.kt @@ -110,7 +110,9 @@ fun HomeScreen( ?: remember { mutableStateOf(null) } LaunchedEffect(Unit) { - viewModel.getChatRooms() + if (qrResult == null) { + viewModel.getChatRooms() + } } LaunchedEffect(qrResult) { diff --git a/shared/src/commonMain/kotlin/su/reya/coop/NostrViewModel.kt b/shared/src/commonMain/kotlin/su/reya/coop/NostrViewModel.kt index 8a36748..4f2d0a8 100644 --- a/shared/src/commonMain/kotlin/su/reya/coop/NostrViewModel.kt +++ b/shared/src/commonMain/kotlin/su/reya/coop/NostrViewModel.kt @@ -436,7 +436,13 @@ class NostrViewModel( fun getChatRooms() { viewModelScope.launch { - _chatRooms.value = nostr.getChatRooms() ?: emptySet() + val rooms = nostr.getChatRooms() ?: emptySet() + _chatRooms.update { currentRooms -> + val virtualRooms = currentRooms.filter { local -> + rooms.none { db -> db.id == local.id } + } + rooms + virtualRooms + } } }