Skip to content

Commit 1a93d96

Browse files
cursoragentJonasBa
andcommitted
Fix menu items not appearing by conditionally building items array
Instead of using hidden property which causes empty menus, conditionally build the items array based on feature flags. Co-authored-by: Jonas <JonasBa@users.noreply.github.com>
1 parent 297d46c commit 1a93d96

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

static/app/views/navigation/primary/noOrganizationDropdown.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ export function NoOrganizationDropdown() {
2525
? localizeDomain(ConfigStore.get('links').sentryUrl) + '/organizations/new/'
2626
: '/organizations/new/';
2727

28+
const items = configFeatures.has('organizations:create')
29+
? [
30+
{
31+
key: 'create-organization',
32+
leadingItems: <IconAdd />,
33+
label: t('Create a new organization'),
34+
...(configFeatures.has('system:multi-region')
35+
? {externalHref: createOrgUrl}
36+
: {to: createOrgUrl}),
37+
},
38+
]
39+
: [];
40+
2841
return (
2942
<DropdownMenu
3043
usePortal
@@ -44,17 +57,7 @@ export function NoOrganizationDropdown() {
4457
)}
4558
position="right-start"
4659
minMenuWidth={200}
47-
items={[
48-
{
49-
key: 'create-organization',
50-
leadingItems: <IconAdd />,
51-
label: t('Create a new organization'),
52-
...(configFeatures.has('system:multi-region')
53-
? {externalHref: createOrgUrl}
54-
: {to: createOrgUrl}),
55-
hidden: !configFeatures.has('organizations:create'),
56-
},
57-
]}
60+
items={items}
5861
/>
5962
);
6063
}

0 commit comments

Comments
 (0)