Skip to content

fix(site): gracefully handle reselection of the same preset #17014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 20, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(site): gracefully handle reselection of the same preset
  • Loading branch information
SasSwart committed Mar 20, 2025
commit 747699f21abccc4494d79a2a94153d65d701e3d9
10 changes: 6 additions & 4 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,13 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
label="Preset"
options={presetOptions}
onSelect={(option) => {
setSelectedPresetIndex(
presetOptions.findIndex(
(preset) => preset.value === option?.value,
),
const index = presetOptions.findIndex(
(preset) => preset.value === option?.value,
);
if (index === -1) {
return;
}
setSelectedPresetIndex(index);
}}
placeholder="Select a preset"
selectedOption={presetOptions[selectedPresetIndex]}
Expand Down
Loading