Skip to content

Commit 82a513b

Browse files
committed
PR feedback
1 parent ad7a3d0 commit 82a513b

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

site/src/components/DeploySettingsLayout/Option.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,30 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
8585
if (typeof children === "object" && !Array.isArray(children)) {
8686
return (
8787
<ul css={listStyles}>
88-
{Object.entries(children).map(([option, isEnabled]) => (
89-
<li key={option} css={optionStyles}>
90-
<Box
91-
sx={{
92-
display: "inline-flex",
93-
alignItems: "center",
94-
}}
95-
>
96-
{option}
97-
{isEnabled && (
98-
<CheckCircleOutlined
99-
sx={{
100-
width: 16,
101-
height: 16,
102-
color: (theme) => theme.palette.success.light,
103-
margin: (theme) => theme.spacing(0, 1),
104-
}}
105-
/>
106-
)}
107-
</Box>
108-
</li>
109-
))}
88+
{Object.entries(children)
89+
.sort((a, b) => a[0].localeCompare(b[0]))
90+
.map(([option, isEnabled]) => (
91+
<li key={option} css={optionStyles}>
92+
<Box
93+
sx={{
94+
display: "inline-flex",
95+
alignItems: "center",
96+
}}
97+
>
98+
{option}
99+
{isEnabled && (
100+
<CheckCircleOutlined
101+
sx={{
102+
width: 16,
103+
height: 16,
104+
color: (theme) => theme.palette.success.light,
105+
margin: (theme) => theme.spacing(0, 1),
106+
}}
107+
/>
108+
)}
109+
</Box>
110+
</li>
111+
))}
110112
</ul>
111113
);
112114
}

site/src/components/DeploySettingsLayout/optionValue.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ export function optionValue(
3131
{} as Record<string, boolean>,
3232
);
3333

34+
if (!experimentMap) {
35+
break;
36+
}
37+
3438
for (const v of option.value) {
35-
if (
36-
experimentMap &&
37-
Object.prototype.hasOwnProperty.call(experimentMap, v)
38-
) {
39+
if (Object.hasOwn(experimentMap, v)) {
3940
experimentMap[v] = true;
4041
}
4142
}

0 commit comments

Comments
 (0)