mirror of
https://github.com/block/buzz.git
synced 2026-11-04 08:21:48 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -202,17 +202,17 @@ export function ChannelScreen({
|
||||
const pLookup = new Map<string, string>();
|
||||
const rLookup = new Map<string, RespondToMode>();
|
||||
|
||||
// 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,
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user