forked from Kieran/zap.stream
Profile loading hook bug
This commit is contained in:
parent
ec518f4f6f
commit
4903e142d7
@ -38,7 +38,7 @@ export function Profile({
|
|||||||
profile?: UserMetadata
|
profile?: UserMetadata
|
||||||
}) {
|
}) {
|
||||||
const { inView, ref } = useInView();
|
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 showAvatar = options?.showAvatar ?? true;
|
||||||
const showName = options?.showName ?? true;
|
const showName = options?.showName ?? true;
|
||||||
|
|
||||||
@ -49,16 +49,16 @@ export function Profile({
|
|||||||
<Icon size={40} name="zap-filled" />
|
<Icon size={40} name="zap-filled" />
|
||||||
) : (
|
) : (
|
||||||
<img
|
<img
|
||||||
alt={profile?.name || pubkey}
|
alt={pLoaded?.name || pubkey}
|
||||||
className={avatarClassname ? avatarClassname : ""}
|
className={avatarClassname ? avatarClassname : ""}
|
||||||
src={profile?.picture ?? ""}
|
src={pLoaded?.picture ?? ""}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{showName && (
|
{showName && (
|
||||||
<span>
|
<span>
|
||||||
{options?.overrideName ?? pubkey === "anon"
|
{options?.overrideName ?? pubkey === "anon"
|
||||||
? "Anon"
|
? "Anon"
|
||||||
: getName(pubkey, profile)}
|
: getName(pubkey, pLoaded)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user