Skip to content

Commit 0633d20

Browse files
authored
refactor: [REL-11344] sort project + env options (#451)
refactor: sort options
1 parent b22ea30 commit 0633d20

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

packages/toolbar/src/core/ui/Toolbar/components/new/Settings/EnvironmentSelector.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ export function EnvironmentSelector() {
77
const { environments, loading } = useProjectContext();
88

99
const environmentOptions = useMemo(() => {
10-
return environments.map((env) => ({
11-
id: env.key,
12-
label: env.name,
13-
}));
10+
return environments
11+
.map((env) => ({
12+
id: env.key,
13+
label: env.name,
14+
}))
15+
.sort((a, b) => a.label.localeCompare(b.label));
1416
}, [environments]);
1517

1618
const handleEnvironmentSelect = (key: string | null) => {

packages/toolbar/src/core/ui/Toolbar/components/new/Settings/ProjectSelector.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ export function ProjectSelector() {
1414
}, [projects, getProjects]);
1515

1616
const projectOptions = useMemo(() => {
17-
return projects.map((project) => ({
18-
id: project.key,
19-
label: project.name,
20-
}));
17+
return projects
18+
.map((project) => ({
19+
id: project.key,
20+
label: project.name,
21+
}))
22+
.sort((a, b) => a.label.localeCompare(b.label));
2123
}, [projects]);
2224

2325
const handleProjectSelect = (key: string | null) => {

0 commit comments

Comments
 (0)