mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
debug: add log to verify post-processing adds loading class
- Log when loading class is added to profile links during post-processing - Will help verify the shimmer is being applied correctly
This commit is contained in:
@@ -241,13 +241,8 @@ export function useProfileLabels(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Set fallback labels for profiles that weren't found
|
// Don't set fallback labels in the Map - we'll use fallback directly when rendering
|
||||||
profileData.forEach(({ pubkey }) => {
|
// This allows us to distinguish between "no label yet" (use fallback) vs "resolved label" (use Map value)
|
||||||
if (!labels.has(pubkey)) {
|
|
||||||
const fallback = getNpubFallbackDisplay(pubkey)
|
|
||||||
labels.set(pubkey, fallback)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
setProfileLabels(new Map(labels))
|
setProfileLabels(new Map(labels))
|
||||||
setProfileLoading(new Map(loading))
|
setProfileLoading(new Map(loading))
|
||||||
|
|||||||
@@ -339,12 +339,14 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
const pubkey = decoded.type === 'npub' ? decoded.data : decoded.data.pubkey
|
const pubkey = decoded.type === 'npub' ? decoded.data : decoded.data.pubkey
|
||||||
|
|
||||||
// Check if we have a resolved profile name using pubkey as key
|
// Check if we have a resolved profile name using pubkey as key
|
||||||
if (profileLabels.has(pubkey)) {
|
// Only use Map value if profile is not loading (meaning it's actually resolved)
|
||||||
|
const isLoading = profileLoading.get(pubkey)
|
||||||
|
if (!isLoading && profileLabels.has(pubkey)) {
|
||||||
const displayName = profileLabels.get(pubkey)!
|
const displayName = profileLabels.get(pubkey)!
|
||||||
return `[${displayName}](${link})`
|
return `[${displayName}](${link})`
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no resolved label yet, use fallback (will show loading via post-processing)
|
// If loading or no resolved label yet, use fallback (will show loading via post-processing)
|
||||||
const label = getNostrUriLabel(encoded)
|
const label = getNostrUriLabel(encoded)
|
||||||
return `[${label}](${link})`
|
return `[${label}](${link})`
|
||||||
}
|
}
|
||||||
@@ -381,7 +383,9 @@ export function addLoadingClassToProfileLinks(
|
|||||||
const pubkey = decoded.data
|
const pubkey = decoded.data
|
||||||
|
|
||||||
// Check if this profile is loading
|
// Check if this profile is loading
|
||||||
if (profileLoading.get(pubkey) === true) {
|
const isLoading = profileLoading.get(pubkey)
|
||||||
|
if (isLoading === true) {
|
||||||
|
console.log(`[profile-loading-debug][post-process] Adding loading class to link for ${pubkey.slice(0, 16)}...`)
|
||||||
// Add profile-loading class if not already present
|
// Add profile-loading class if not already present
|
||||||
if (!match.includes('profile-loading')) {
|
if (!match.includes('profile-loading')) {
|
||||||
// Insert class before the closing >
|
// Insert class before the closing >
|
||||||
|
|||||||
Reference in New Issue
Block a user