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
This commit is contained in:
Gigi
2025-11-02 22:55:14 +01:00
parent d41cbb5305
commit fd2d4d106f

View File

@@ -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 `[<span class="profile-loading">${label}</span>](${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