From 7accb5e2b92148d4ed570b640c0334e21487c870 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 5 May 2025 18:34:54 -0400 Subject: [PATCH] Adds onStart calculator for live bubble authors --- .../relayClient/reqCommand/channel/ChannelObservers.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt index 565291d61..13a605be0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/channel/ChannelObservers.kt @@ -38,6 +38,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.mapLatest +import kotlinx.coroutines.flow.onStart @Composable fun observeChannel(baseChannel: Channel): State { @@ -49,6 +50,7 @@ fun observeChannel(baseChannel: Channel): State { .collectAsStateWithLifecycle() } +@OptIn(ExperimentalCoroutinesApi::class) @Composable fun observeChannelNoteAuthors(baseChannel: Channel): State> { ChannelFinderFilterAssemblerSubscription(baseChannel) @@ -64,6 +66,11 @@ fun observeChannelNoteAuthors(baseChannel: Channel): State> .mapNotNull { key, value -> value.author } .toSet() .toImmutableList() + }.onStart { + baseChannel.notes + .mapNotNull { key, value -> value.author } + .toSet() + .toImmutableList() }.distinctUntilChanged() .flowOn(Dispatchers.Default) }