diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/datasources/ThreadFilterAssemblerSubscription.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/datasources/ThreadFilterAssemblerSubscription.kt index 75e206a528..78d03ffc58 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/datasources/ThreadFilterAssemblerSubscription.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/datasources/ThreadFilterAssemblerSubscription.kt @@ -22,10 +22,8 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.threadview.datasources import androidx.compose.runtime.Composable import androidx.compose.runtime.remember -import com.vitorpamplona.amethyst.commons.model.ThreadAssembler import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.LifecycleAwareKeyDataSourceSubscription import com.vitorpamplona.amethyst.model.Account -import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.HexKey @@ -59,25 +57,20 @@ fun ThreadFilterAssemblerSubscription( /** * Eagerly pre-loads the whole thread of a reply that is visible in a feed. * - * When a reply shows up in `NoteCompose`, this resolves the thread root and opens - * the same root subscription the thread screen uses (a filter on the root's `e`/`a` - * tag, covering NIP-10 and NIP-22 event/addressable roots), so tapping into the - * conversation finds it already loaded. Keying on the resolved root id means every - * visible reply that shares a root collapses onto a single subscription, and a note - * that is itself a root (no parent) is skipped — nothing to pre-load. + * When a reply shows up in `NoteCompose`, this opens the same root subscription the + * thread screen uses: `ThreadFilterSubAssembler` resolves the thread root from this + * id and subscribes to the root's `e`/`a` tag (covering NIP-10 and NIP-22 event / + * addressable roots), so tapping into the conversation finds it already loaded. + * + * Only replies are pre-loaded — a root post (empty `replyTo`) has no ancestor thread + * to pull, and pure quotes are excluded because citations don't populate `replyTo`. */ @Composable fun PreloadThreadForReply( note: Note, accountViewModel: AccountViewModel, ) { - val rootId = - remember(note) { - val root = ThreadAssembler(LocalCache).findRoot(note.idHex) - if (root != null && root != note) root.idHex else null - } - - if (rootId != null) { - ThreadFilterAssemblerSubscription(rootId, accountViewModel) + if (note.replyTo?.isNotEmpty() == true) { + ThreadFilterAssemblerSubscription(note.idHex, accountViewModel) } }