fix for single selects with values selected
This commit is contained in:
parent
bb890fa5f0
commit
22210564e7
1 changed files with 3 additions and 2 deletions
|
@ -105,8 +105,8 @@ const SingleAutocompleteSelectFieldComponent: React.FC<SingleAutocompleteSelectF
|
||||||
selectedItem={value || ""}
|
selectedItem={value || ""}
|
||||||
// this is to prevent unwanted state updates when the dropdown is closed with an empty value,
|
// this is to prevent unwanted state updates when the dropdown is closed with an empty value,
|
||||||
// which downshift interprets as the value being updated with an empty string, causing side-effects
|
// which downshift interprets as the value being updated with an empty string, causing side-effects
|
||||||
stateReducer={(state, changes) => {
|
stateReducer={(_, changes) => {
|
||||||
if (changes.isOpen === false && state.inputValue === "") {
|
if (changes.isOpen === false) {
|
||||||
delete changes.inputValue;
|
delete changes.inputValue;
|
||||||
}
|
}
|
||||||
return changes;
|
return changes;
|
||||||
|
@ -210,6 +210,7 @@ const SingleAutocompleteSelectFieldComponent: React.FC<SingleAutocompleteSelectF
|
||||||
FormHelperTextProps={FormHelperTextProps}
|
FormHelperTextProps={FormHelperTextProps}
|
||||||
label={label}
|
label={label}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
|
onBlur={onBlur}
|
||||||
/>
|
/>
|
||||||
{isOpen && (!!inputValue || !!choices.length) && (
|
{isOpen && (!!inputValue || !!choices.length) && (
|
||||||
<SingleAutocompleteSelectFieldContent
|
<SingleAutocompleteSelectFieldContent
|
||||||
|
|
Loading…
Reference in a new issue