adding ? before accessing length to prevent white screen error
This commit is contained in:
parent
41f3374982
commit
de855c6fdb
1 changed files with 6 additions and 6 deletions
|
|
@ -166,7 +166,7 @@ export default function UserMenu() {
|
|||
);
|
||||
};
|
||||
|
||||
if (user.id().length < 1) return unauthenticatedUserMenu()
|
||||
if (user.id()?.length < 1) return unauthenticatedUserMenu()
|
||||
|
||||
const hasAdmin = user.hasFeature ? user.hasFeature("admin") : false;
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ export default function UserMenu() {
|
|||
<UserTeamName user={user} team={team} />
|
||||
</Box>
|
||||
<Box style={{ marginLeft: theme.spacing(1) }}>
|
||||
{picture && hasTeams && team.id().length > 0 ? (
|
||||
{picture && hasTeams && team.id()?.length > 0 ? (
|
||||
<div>
|
||||
<UserAvatar
|
||||
user={user}
|
||||
|
|
@ -238,7 +238,7 @@ export default function UserMenu() {
|
|||
{hasTeams && (
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
if (as.length > 1) {
|
||||
if (as?.length > 1) {
|
||||
user.settings.useTeam = false;
|
||||
dispatch({ key: "as", value: "" });
|
||||
userAPI.updateUser(user.id(), user.protobuf()).then(_resp => {
|
||||
|
|
@ -252,13 +252,13 @@ export default function UserMenu() {
|
|||
});
|
||||
}
|
||||
}}
|
||||
disabled={user.settings.defaultTeam.length < 1}
|
||||
disabled={user.settings.defaultTeam?.length < 1}
|
||||
aria-label="Open Team Menu"
|
||||
dense>
|
||||
<ListItemIcon>
|
||||
<Checkbox
|
||||
disabled={user.settings.defaultTeam.length < 1}
|
||||
checked={as.length > 1}
|
||||
disabled={user.settings.defaultTeam?.length < 1}
|
||||
checked={as?.length > 1}
|
||||
style={{ margin: 0, padding: 0 }}
|
||||
/>
|
||||
</ListItemIcon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue