From 69571a812b87f5b8cdb520e6d362fe6a36e0eb74 Mon Sep 17 00:00:00 2001 From: Wes Date: Thu, 14 May 2026 14:26:56 -0700 Subject: [PATCH] fix: add respondTo to memo comparator and gate lookup to bot pubkeys Two review fixes: 1. MessageRow.tsx: add prev.message.respondTo === next.message.respondTo to the React.memo comparator so the icon overlay updates when profiles load asynchronously. 2. ChannelScreen.tsx: only populate respondToLookup for pubkeys with role === "bot" in channel members. Prevents human users who publish respond_to in their kind:0 profile from incorrectly showing the icon. Co-Authored-By: Claude Opus 4.6 --- .../src/features/channels/ui/ChannelScreen.tsx | 17 +++++++++-------- desktop/src/features/messages/ui/MessageRow.tsx | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/desktop/src/features/channels/ui/ChannelScreen.tsx b/desktop/src/features/channels/ui/ChannelScreen.tsx index ac2c8b891a..0c82997b15 100644 --- a/desktop/src/features/channels/ui/ChannelScreen.tsx +++ b/desktop/src/features/channels/ui/ChannelScreen.tsx @@ -202,17 +202,17 @@ export function ChannelScreen({ const pLookup = new Map(); const rLookup = new Map(); - // Populate from profile data (works for all bots, including other users' bots). + const botPubkeys = new Set( + (channelMembers ?? []) + .filter((m) => m.role === "bot") + .map((m) => m.pubkey.toLowerCase()), + ); const profiles = messageProfilesQuery.data?.profiles; if (profiles) { for (const [pubkey, profile] of Object.entries(profiles)) { - if ( - profile.respondTo === "anyone" || - profile.respondTo === "allowlist" || - profile.respondTo === "owner-only" - ) { - rLookup.set(pubkey.toLowerCase(), profile.respondTo); - } + const key = pubkey.toLowerCase(); + const rt = profile.respondTo as RespondToMode | null; + if (botPubkeys.has(key) && rt) rLookup.set(key, rt); } } @@ -225,6 +225,7 @@ export function ChannelScreen({ } return { personaLookup: pLookup, respondToLookup: rLookup }; }, [ + channelMembers, managedAgentsQuery.data, messageProfilesQuery.data?.profiles, personasQuery.data, diff --git a/desktop/src/features/messages/ui/MessageRow.tsx b/desktop/src/features/messages/ui/MessageRow.tsx index 9af00ee0d4..f423651146 100644 --- a/desktop/src/features/messages/ui/MessageRow.tsx +++ b/desktop/src/features/messages/ui/MessageRow.tsx @@ -391,6 +391,7 @@ export const MessageRow = React.memo( prev.message.tags === next.message.tags && prev.message.role === next.message.role && prev.message.personaDisplayName === next.message.personaDisplayName && + prev.message.respondTo === next.message.respondTo && prev.highlighted === next.highlighted && prev.activeReplyTargetId === next.activeReplyTargetId && prev.layoutVariant === next.layoutVariant &&