Fix profile dropdown crash by wrapping GroupLabel in Group

Menu.GroupLabel requires a parent Menu.Group for context. Without it,
clicking the profile avatar crashed the client.

Made-with: Cursor
This commit is contained in:
Randall Stillwell 2026-04-07 12:13:16 -05:00
parent 41000337e3
commit 6fdf68bc89

View file

@ -21,6 +21,7 @@ import {
DropdownMenu, DropdownMenu,
DropdownMenuTrigger, DropdownMenuTrigger,
DropdownMenuContent, DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem, DropdownMenuItem,
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuLabel, DropdownMenuLabel,
@ -122,26 +123,28 @@ export function TopBar() {
</Avatar> </Avatar>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end" sideOffset={8} className="w-56"> <DropdownMenuContent align="end" sideOffset={8} className="w-56">
<DropdownMenuLabel className="font-normal"> <DropdownMenuGroup>
<div className="flex items-center gap-3 px-0.5 py-1"> <DropdownMenuLabel className="font-normal">
<Avatar> <div className="flex items-center gap-3 px-0.5 py-1">
{profile.avatarUrl && <AvatarImage src={profile.avatarUrl} alt={profile.displayName} />} <Avatar>
<AvatarFallback className="text-xs"> {profile.avatarUrl && <AvatarImage src={profile.avatarUrl} alt={profile.displayName} />}
{initials || <User className="size-4" />} <AvatarFallback className="text-xs">
</AvatarFallback> {initials || <User className="size-4" />}
</Avatar> </AvatarFallback>
<div className="min-w-0 flex-1"> </Avatar>
<p className="truncate text-sm font-medium text-foreground"> <div className="min-w-0 flex-1">
{profile.displayName || "Set up profile"} <p className="truncate text-sm font-medium text-foreground">
</p> {profile.displayName || "Set up profile"}
{profile.email && (
<p className="truncate text-xs text-muted-foreground">
{profile.email}
</p> </p>
)} {profile.email && (
<p className="truncate text-xs text-muted-foreground">
{profile.email}
</p>
)}
</div>
</div> </div>
</div> </DropdownMenuLabel>
</DropdownMenuLabel> </DropdownMenuGroup>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItem render={<Link href="/profile" />}> <DropdownMenuItem render={<Link href="/profile" />}>
<UserCircle className="size-4" /> <UserCircle className="size-4" />