From 560c4fcff5af81c70c24bc2bb61f161f6df2d400 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 25 Jul 2026 05:10:48 +0000 Subject: [PATCH] Revert "refactor: derive relay-group row preview from note cache, not lastNote" This reverts commit 7b894df43313336b7bb92cb228f60ba54429f1c0. --- .../relayGroup/RelayGroupDiscoveryScreen.kt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt index 99384a7078..eb107ed216 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/relayGroup/RelayGroupDiscoveryScreen.kt @@ -58,7 +58,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.commons.icons.symbols.Icon import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols -import com.vitorpamplona.amethyst.commons.model.Channel import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.nip29RelayGroups.RelayGroupChannel import com.vitorpamplona.amethyst.commons.ui.feeds.FeedContentState @@ -442,10 +441,7 @@ private fun RelayGroupRailRow( .notes.stateFlow .collectAsStateWithLifecycle() val messageCount = notesState.channel.notes.size() - // Derive the newest message from the note cache (not Channel.lastNote) so the preview + its - // timestamp advance in lockstep with the count as new kind-9s stream in — the same approach - // Concord's list previews use. Reading lastNote directly can lag behind the cache. - val lastNote = remember(notesState) { newestGroupChatMessage(notesState.channel) } + val lastNote = notesState.channel.lastNote val participatingFollows = remember(channelState, follows) { channel.participatingFollows(follows) } @@ -702,18 +698,6 @@ private fun CompactFollowFaces( } } -/** - * The newest chat message loaded for this group, derived from the note cache each time it changes - * rather than read from [Channel.lastNote] — so the row's preview + timestamp advance in lockstep - * with the live message count as the warm-up subscription streams new kind-9s in (mirrors how - * Concord's list previews stay current). NIP-29 threads (kind-11/1111) live in a separate collection, - * so `notes` is already just the chat timeline; only skip notes whose event hasn't loaded yet. - */ -private fun newestGroupChatMessage(channel: Channel): Note? = - channel.notes - .filter { _, note -> note.event != null } - .minWithOrNull(Channel.DefaultFeedOrder) - /** * Display cap for the loaded-message counter — kept in step with the discovery preview's fetch * limit (RELAY_GROUP_WARMUP_LIMIT), so a chat that returns the full page reads as "50+".