From fd2d4d106f362389ca9d718f05ac88f8b2d8bc7e Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 2 Nov 2025 22:55:14 +0100 Subject: [PATCH] fix: check loading state before resolved labels to show shimmer - Check loading state FIRST before checking for resolved labels - Profiles have fallback labels immediately, which caused early return - Now loading shimmer will show even when fallback label exists - This fixes the issue where shimmer never appeared --- src/utils/nostrUriResolver.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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