Skip to content

Commit 4f849c6

Browse files
voidstackloopclaude
andcommitted
Fix org-switcher dropdown crash in admin-console header
Found via a live functionality tour of the admin console: the header's org-switcher menu rendered <DropdownMenuLabel>Switch organization</DropdownMenuLabel> without wrapping it in <DropdownMenuGroup>, which Base UI's Menu primitive requires (Menu.GroupLabel must live inside Menu.Group or Menu.RadioGroup). React's error boundary silently recovered each time, so the UI still looked fine, but it threw on every render of that menu. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 075b120 commit 4f849c6

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎admin-console/src/components/layout.tsx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Button } from "@/components/ui/button";
44
import {
55
DropdownMenu,
66
DropdownMenuContent,
7+
DropdownMenuGroup,
78
DropdownMenuItem,
89
DropdownMenuLabel,
910
DropdownMenuSeparator,
@@ -57,14 +58,16 @@ export default function Layout() {
5758
}
5859
/>
5960
<DropdownMenuContent align="end">
60-
<DropdownMenuLabel>Switch organization</DropdownMenuLabel>
61-
<DropdownMenuSeparator />
62-
{me?.memberships.map((m) => (
63-
<DropdownMenuItem key={m.organization.id} onClick={() => navigate(`/organizations/${m.organization.id}/users`)}>
64-
{m.organization.name}
65-
{m.organization.id === organizationId && <span className="ml-auto text-xs text-muted-foreground">current</span>}
66-
</DropdownMenuItem>
67-
))}
61+
<DropdownMenuGroup>
62+
<DropdownMenuLabel>Switch organization</DropdownMenuLabel>
63+
<DropdownMenuSeparator />
64+
{me?.memberships.map((m) => (
65+
<DropdownMenuItem key={m.organization.id} onClick={() => navigate(`/organizations/${m.organization.id}/users`)}>
66+
{m.organization.name}
67+
{m.organization.id === organizationId && <span className="ml-auto text-xs text-muted-foreground">current</span>}
68+
</DropdownMenuItem>
69+
))}
70+
</DropdownMenuGroup>
6871
<DropdownMenuSeparator />
6972
<DropdownMenuItem onClick={() => navigate("/")}>All organizations…</DropdownMenuItem>
7073
</DropdownMenuContent>

0 commit comments

Comments
 (0)