diff --git a/src/utils/nostrUriResolver.tsx b/src/utils/nostrUriResolver.tsx index e11b7446..335f9c2c 100644 --- a/src/utils/nostrUriResolver.tsx +++ b/src/utils/nostrUriResolver.tsx @@ -338,13 +338,7 @@ export function replaceNostrUrisInMarkdownWithProfileLabels( if (decoded.type === 'npub' || decoded.type === 'nprofile') { const pubkey = decoded.type === 'npub' ? decoded.data : decoded.data.pubkey - // Check if we have a resolved profile name using pubkey as key - if (profileLabels.has(pubkey)) { - const displayName = profileLabels.get(pubkey)! - return `[${displayName}](${link})` - } - - // Check loading state using pubkey as key + // Check loading state FIRST - show loading even if we have a fallback label const isLoading = profileLoading.get(pubkey) if (isLoading === true) { const label = getNostrUriLabel(encoded) @@ -352,6 +346,12 @@ export function replaceNostrUrisInMarkdownWithProfileLabels( // Wrap in span with profile-loading class for CSS styling return `[${label}](${link})` } + + // Check if we have a resolved profile name using pubkey as key + if (profileLabels.has(pubkey)) { + const displayName = profileLabels.get(pubkey)! + return `[${displayName}](${link})` + } } } catch (error) { // Ignore decode errors, fall through to default label