feat(ui): improve logged-in user profile resolution

- Add debug logging to track profile loading
- Show 'Loading profile...' while profile data is being fetched
- Better handling of profile loading states
- Ensures user sees proper name instead of pubkey when available
This commit is contained in:
Gigi
2025-10-03 00:04:11 +02:00
parent 6d585dcef6
commit 5495890204

View File

@@ -75,6 +75,10 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
const formatUserDisplay = () => {
if (!activeAccount) return 'Unknown User'
// Debug profile loading
console.log('Profile data:', profile)
console.log('Active account pubkey:', activeAccount.pubkey)
// Use profile data from ProfileModel if available
if (profile?.name) {
return profile.name
@@ -86,6 +90,11 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
return profile.nip05
}
// Show loading state while profile is being fetched
if (profile === undefined) {
return 'Loading profile...'
}
// Fallback to formatted public key
return `${activeAccount.pubkey.slice(0, 8)}...${activeAccount.pubkey.slice(-8)}`
}