mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
perf(marmot): skip the relay-icon lookup for rows that show members' faces
An unnamed, avatarless group (a White Noise 1:1) draws its members, but the row resolved the group picture first, a NIP-11 relay-info fetch per row that was then thrown away. The picture is now resolved only on the branch that draws it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1f05937752
commit
f088a3a7fb
+11
-10
@@ -521,16 +521,6 @@ private fun MarmotGroupRoomCompose(
|
||||
val otherMembers = remember(members) { marmotOtherMembers(members, accountViewModel.account.signer.pubKey) }
|
||||
val groupName = marmotGroupTitle(displayName, otherMembers, chatroom.nostrGroupId, accountViewModel)
|
||||
|
||||
// Prefer the group's own avatar — the plain https link first, then the
|
||||
// encrypted Blossom blob; when it has neither, fall back to the NIP-11 icon
|
||||
// of one of the group's relays (fetched on a cache miss).
|
||||
val channelPicture =
|
||||
if (avatarUrl != null || image != null) {
|
||||
rememberMarmotGroupAvatarUrl(avatarUrl, image, accountViewModel, adminPubkeys)
|
||||
} else {
|
||||
loadMarmotRelayIcon(relays)
|
||||
}
|
||||
|
||||
// The row is handed the group's placeholder note when it has no messages.
|
||||
val lastContent = marmotGroupPreviewText(lastMessage.takeIf { it.event != null }, accountViewModel)
|
||||
|
||||
@@ -551,6 +541,17 @@ private fun MarmotGroupRoomCompose(
|
||||
return
|
||||
}
|
||||
|
||||
// Prefer the group's own avatar — the plain https link first, then the
|
||||
// encrypted Blossom blob; when it has neither, fall back to the NIP-11 icon
|
||||
// of one of the group's relays (fetched on a cache miss). Resolved only here: a row that
|
||||
// shows its members' faces above never draws it, and the relay icon is a NIP-11 fetch.
|
||||
val channelPicture =
|
||||
if (avatarUrl != null || image != null) {
|
||||
rememberMarmotGroupAvatarUrl(avatarUrl, image, accountViewModel, adminPubkeys)
|
||||
} else {
|
||||
loadMarmotRelayIcon(relays)
|
||||
}
|
||||
|
||||
ChannelName(
|
||||
channelIdHex = chatroom.nostrGroupId,
|
||||
channelPicture = channelPicture,
|
||||
|
||||
Reference in New Issue
Block a user