From 11272f51b50ea31107bb370b7d1760bab4c9df73 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Mon, 15 Jun 2026 14:45:07 +0200 Subject: [PATCH] Bug fix on collecting feeds --- .../auxiliary/compose/ui/view/model/FeedListViewModel.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/view/model/FeedListViewModel.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/view/model/FeedListViewModel.kt index cda290ab..c2e3b14a 100755 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/view/model/FeedListViewModel.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/view/model/FeedListViewModel.kt @@ -37,7 +37,10 @@ import co.touchlab.kermit.Logger import com.vitorpamplona.quartz.nip01Core.core.HexKey import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO +import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.launch import kotlin.time.Clock import kotlin.time.Duration.Companion.days @@ -79,7 +82,7 @@ class FeedListViewModel( viewModelScope.launch(Dispatchers.IO) { nostrRepository.observeNostrFeed( synchronizationFilter - ).distinctUntilChanged().collect { localNostrEvents -> + ).distinctUntilChanged().first().let { localNostrEvents -> feedListUIState = FeedListUIState.Loaded( localNostrEvents = localNostrEvents )