Skip to content

Commit

Permalink
Add optional chaining because name can be undefined (#91)
Browse files Browse the repository at this point in the history
* Add optional chaining because name can be undefined

* fmt
  • Loading branch information
franknoirot authored Jan 5, 2024
1 parent f647fde commit eea13bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/AccountMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
{#if shouldDisplayInitial}
<span
class="w-5 h-5 font-bold text-xl leading-[1] pt-0.5 text-center text-chalkboard-10 dark:text-chalkboard-120"
data-testid="initial">{user.name[0] || user.first_name[0] || user.email[0]}</span
data-testid="initial"
>
{user.name?.[0] || user.first_name?.[0] || user.email?.[0]}
</span>
{:else if !shouldDisplayImage}
<Person
data-testid="person-icon"
Expand Down

0 comments on commit eea13bf

Please sign in to comment.