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 + } } }