Skip to content

Commit

Permalink
fix: [M3-8661] - Fix crash in Volume Create page caused by misconfigu…
Browse files Browse the repository at this point in the history
…red Autocomplete (#11001)

* Fix ConfigSelect uncontrolled Autocomplete warning

* Added changeset: Crash when switching between Linodes in Volume Create page

* Remove changeset
  • Loading branch information
hkhalil-akamai authored Sep 25, 2024
1 parent 0a70c60 commit 02058c6
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Props {
linodeId: null | number;
name: string;
onBlur: (e: any) => void;
onChange: (value: number) => void;
onChange: (value: number | undefined) => void;
value: null | number;
width?: number;
}
Expand Down Expand Up @@ -63,14 +63,12 @@ export const ConfigSelect = React.memo((props: Props) => {
: 'No options.'
}
onChange={(_, selected) => {
onChange(+selected.value);
onChange(selected !== null ? +selected?.value : undefined);
}}
value={
value && value !== -1
? configList?.find((thisConfig) => thisConfig.value === value)
: { label: '', value: -1 }
configList?.find((thisConfig) => thisConfig.value === value) ?? null
}
disableClearable
clearIcon={null}
id={name}
isOptionEqualToValue={(option, value) => option.value === value.value}
label="Config"
Expand Down

0 comments on commit 02058c6

Please sign in to comment.