From 02058c688f2f0f368574c0b32ad7aa6e00ecd9fb Mon Sep 17 00:00:00 2001 From: Hussain Khalil <122488130+hkhalil-akamai@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:35:23 -0400 Subject: [PATCH] fix: [M3-8661] - Fix crash in Volume Create page caused by misconfigured Autocomplete (#11001) * Fix ConfigSelect uncontrolled Autocomplete warning * Added changeset: Crash when switching between Linodes in Volume Create page * Remove changeset --- .../src/features/Volumes/VolumeDrawer/ConfigSelect.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/manager/src/features/Volumes/VolumeDrawer/ConfigSelect.tsx b/packages/manager/src/features/Volumes/VolumeDrawer/ConfigSelect.tsx index 3e7ec93a784..8f41357c8b4 100644 --- a/packages/manager/src/features/Volumes/VolumeDrawer/ConfigSelect.tsx +++ b/packages/manager/src/features/Volumes/VolumeDrawer/ConfigSelect.tsx @@ -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; } @@ -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"