diff --git a/src/element/profile.tsx b/src/element/profile.tsx index 0dd8bf1..08d1ef7 100644 --- a/src/element/profile.tsx +++ b/src/element/profile.tsx @@ -38,7 +38,7 @@ export function Profile({ profile?: UserMetadata }) { const { inView, ref } = useInView(); - profile ??= useUserProfile(System, inView ? pubkey : undefined); + const pLoaded = useUserProfile(System, inView && !profile ? pubkey : undefined) || profile; const showAvatar = options?.showAvatar ?? true; const showName = options?.showName ?? true; @@ -49,16 +49,16 @@ export function Profile({ ) : ( {profile?.name ))} {showName && ( {options?.overrideName ?? pubkey === "anon" ? "Anon" - : getName(pubkey, profile)} + : getName(pubkey, pLoaded)} )}