-
Notifications
You must be signed in to change notification settings - Fork 103
Use loggedInUserData
for Avatar
props
#149
base: dev
Are you sure you want to change the base?
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/statelyai/xstate-viz/DtUvrUdXSdAGfsUmxEFMANVsQRdg |
src/Login.tsx
Outdated
session?.user?.user_metadata?.full_name || | ||
session?.user?.user_metadata?.user_name | ||
} | ||
src={loggedInUserData!.avatarUrl || undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is it possible that this can be undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we assume that we only support GitHub-authorized users - then never. I think GitHub always provides an avatar for us - even if it's a default one. I've actually created a fresh user the other day for testing purposes and the avatar was in its data right from the beginning.
If we don't make that assumption though... this could happen. It's more a future-proof thing rather than a necessity for the current state of things.
9912b33
to
19da0fe
Compare
src={loggedInUserData.avatarUrl || undefined} | ||
name={loggedInUserData.displayName || undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked the implementation of Avatar
.
src
is not required - "initials" are rendered if you don't providesrc
- initials require
name
though - if it's not provided a default icon is used instead
I would actually probably prefer using a fallback icon at all times, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fallback icon is fine 👍
@Andarist Anything preventing this being merged? Other than the conflicts |
…se-logged-in-user-data
|
Merged conflicts, should be fine to go in |
@mattpocock I'll handle this soon-ish. It's just so low priority that it got pushed down on my priority list - since I still want to do some minor changes here |
It's a follow up to #110 (comment)