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;
|
const hasAdmin = user.hasFeature ? user.hasFeature("admin") : false;
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ export default function UserMenu() {
|
||||||
<UserTeamName user={user} team={team} />
|
<UserTeamName user={user} team={team} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box style={{ marginLeft: theme.spacing(1) }}>
|
<Box style={{ marginLeft: theme.spacing(1) }}>
|
||||||
{picture && hasTeams && team.id().length > 0 ? (
|
{picture && hasTeams && team.id()?.length > 0 ? (
|
||||||
<div>
|
<div>
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
user={user}
|
user={user}
|
||||||
|
|
@ -238,7 +238,7 @@ export default function UserMenu() {
|
||||||
{hasTeams && (
|
{hasTeams && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (as.length > 1) {
|
if (as?.length > 1) {
|
||||||
user.settings.useTeam = false;
|
user.settings.useTeam = false;
|
||||||
dispatch({ key: "as", value: "" });
|
dispatch({ key: "as", value: "" });
|
||||||
userAPI.updateUser(user.id(), user.protobuf()).then(_resp => {
|
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"
|
aria-label="Open Team Menu"
|
||||||
dense>
|
dense>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
disabled={user.settings.defaultTeam.length < 1}
|
disabled={user.settings.defaultTeam?.length < 1}
|
||||||
checked={as.length > 1}
|
checked={as?.length > 1}
|
||||||
style={{ margin: 0, padding: 0 }}
|
style={{ margin: 0, padding: 0 }}
|
||||||
/>
|
/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue