refactor: add logging to verify initialLabels are set correctly from cache

This commit is contained in:
Gigi
2025-11-02 21:10:56 +01:00
parent 93eb8a63de
commit 5d36d6de4f

View File

@@ -74,6 +74,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
} }
}) })
if (labels.size > 0) {
console.log(`[${ts()}] [npub-resolve] Initial labels from cache (useMemo):`, labels.size, 'labels')
}
return labels return labels
}, [profileData]) }, [profileData])
@@ -116,6 +119,8 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
// Build labels from localStorage cache and eventStore (initialLabels already has cache, add eventStore) // Build labels from localStorage cache and eventStore (initialLabels already has cache, add eventStore)
// Start with labels from initial cache lookup (in useMemo) // Start with labels from initial cache lookup (in useMemo)
// Note: initialLabels should already have all cached profiles, but we rebuild here
// to also check EventStore and handle any profiles that weren't in cache
const labels = new Map<string, string>(initialLabels) const labels = new Map<string, string>(initialLabels)
const pubkeysToFetch: string[] = [] const pubkeysToFetch: string[] = []