mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
fix(music): subscribe each playlist track to relays so they actually load
LoadAddressableNote only resolves the AddressableNote shell from cache — it doesn't kick off a relay query. So a freshly-arrived playlist whose track events weren't already in the cache sat on the "Loading…" placeholder row forever. For each resolved track shell, wire up EventFinderFilterAssemblerSubscription (same pattern ProfileBadgesScreen uses for badge definitions). Its NoteEventLoaderSubAssembler asks relays for the addressable's actual event, and EventWatcherSubAssembler picks up reactions / replies on top. The subscription is keyed on the AddressableNote and lifecycle-aware, so scrolling the playlist off-screen drops the watchers.
This commit is contained in:
@@ -59,6 +59,7 @@ import com.vitorpamplona.amethyst.commons.model.toImmutableListOfLists
|
||||
import com.vitorpamplona.amethyst.model.AddressableNote
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.EventFinderFilterAssemblerSubscription
|
||||
import com.vitorpamplona.amethyst.ui.components.LoadNote
|
||||
import com.vitorpamplona.amethyst.ui.components.MyAsyncImage
|
||||
import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer
|
||||
@@ -221,6 +222,13 @@ fun MusicPlaylistHeader(
|
||||
}
|
||||
LoadAddressableNote(address, accountViewModel) { trackNote ->
|
||||
if (trackNote != null) {
|
||||
// Ask relays for the track event itself (and its
|
||||
// reactions/replies) so a playlist whose tracks aren't
|
||||
// already in cache populates instead of sitting on the
|
||||
// "Loading…" placeholder. The subscription is keyed on
|
||||
// the AddressableNote and lifecycle-aware, so it stops
|
||||
// when the playlist scrolls off-screen.
|
||||
EventFinderFilterAssemblerSubscription(trackNote, accountViewModel)
|
||||
PlaylistTrackRow(
|
||||
position = index + 1,
|
||||
trackNote = trackNote,
|
||||
|
||||
Reference in New Issue
Block a user