mirror of
https://github.com/snowball-tools/snowballtools-base.git
synced 2024-11-18 04:56:18 +00:00
🐛 fix: on reset error when value is undefined
This commit is contained in:
parent
462d247a86
commit
b6e02fb19d
@ -167,7 +167,8 @@ export const Select = ({
|
|||||||
}
|
}
|
||||||
}, [dropdownOpen]); // Re-calculate whenever the dropdown is opened
|
}, [dropdownOpen]); // Re-calculate whenever the dropdown is opened
|
||||||
|
|
||||||
const handleSelectedItemChange = (selectedItem: SelectOption | null) => {
|
const handleSelectedItemChange = (selectedItem: SelectOption | undefined) => {
|
||||||
|
if (!selectedItem) return;
|
||||||
setSelectedItem(selectedItem);
|
setSelectedItem(selectedItem);
|
||||||
setInputValue(selectedItem ? selectedItem.label : '');
|
setInputValue(selectedItem ? selectedItem.label : '');
|
||||||
onChange?.(selectedItem as SelectOption);
|
onChange?.(selectedItem as SelectOption);
|
||||||
@ -185,7 +186,7 @@ export const Select = ({
|
|||||||
onSelectedItemsChange: multiple
|
onSelectedItemsChange: multiple
|
||||||
? undefined
|
? undefined
|
||||||
: ({ selectedItems }) => {
|
: ({ selectedItems }) => {
|
||||||
handleSelectedItemChange(selectedItems?.[0] || null);
|
handleSelectedItemChange(selectedItems?.[0]);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user