Skip to content

Commit

Permalink
fix: user avatar use profile data if userId passed, fixed #550
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 22, 2024
1 parent bbc2bef commit 176afa7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/renderer/src/components/user-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export function UserAvatar({
return <LoginButton {...props} />
}

const renderUserData = userId ? profile.data : session?.user
return (
<div
className={cn(
Expand All @@ -202,11 +203,11 @@ export function UserAvatar({
>
<AvatarImage
className="duration-200 animate-in fade-in-0"
src={(profile.data || session?.user)?.image || undefined}
src={renderUserData?.image || undefined}
/>
<AvatarFallback>{(profile.data || session?.user)?.name?.slice(0, 2)}</AvatarFallback>
<AvatarFallback>{renderUserData?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
{!hideName && <div>{(profile.data || session?.user)?.name}</div>}
{!hideName && <div>{renderUserData?.name}</div>}
</div>
)
}
Expand Down

0 comments on commit 176afa7

Please sign in to comment.