From 7d174a32093e61e998e53e88d19f63756b61bf25 Mon Sep 17 00:00:00 2001 From: klopez4212 Date: Mon, 29 Jun 2026 20:34:14 +0100 Subject: [PATCH] Wait for profile agent lookup before waving --- .../features/profile/ui/UserProfilePopover.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/desktop/src/features/profile/ui/UserProfilePopover.tsx b/desktop/src/features/profile/ui/UserProfilePopover.tsx index 0a40a0354..f1d99a126 100644 --- a/desktop/src/features/profile/ui/UserProfilePopover.tsx +++ b/desktop/src/features/profile/ui/UserProfilePopover.tsx @@ -204,14 +204,24 @@ export function UserProfilePopover({ (a) => a.pubkey === pubkey, ); const isBotProfile = role === "bot" || Boolean(relayAgent || managedAgent); + const normalizedProfilePubkey = normalizePubkey(pubkey); + const profileAgentSummary = + usersBatchQuery.data?.profiles[normalizedProfilePubkey]; + const isProfileAgentLookupPending = + open && + role !== "bot" && + !isBotProfile && + (usersBatchQuery.isPending || + usersBatchQuery.isPlaceholderData || + (usersBatchQuery.isFetching && profileAgentSummary === undefined)); const isAgentClassificationPending = open && role !== "bot" && - (relayAgentsQuery.isPending || managedAgentsQuery.isPending); + (relayAgentsQuery.isPending || + managedAgentsQuery.isPending || + isProfileAgentLookupPending); const profile = profileQuery.data; - const isAgentByProfile = Boolean( - usersBatchQuery.data?.profiles[normalizePubkey(pubkey)]?.isAgent, - ); + const isAgentByProfile = Boolean(profileAgentSummary?.isAgent); const isAgentTarget = isBotProfile || isAgentByProfile; const displayName = profile?.displayName ?? truncatePubkey(pubkey); // Owner signal mirrors UserProfilePanel: a declared NIP-OA owner whose agent