Skip to content

Commit

Permalink
Merge pull request #5698 from AnkitaGupta111/ReselectEmptyValueSelece…
Browse files Browse the repository at this point in the history
…tionAutocompleteBug

Fix select empty option in AutocompleteInput does not reset the input
  • Loading branch information
fzaninotto committed Dec 21, 2020
2 parents b69a91d + 6995f0e commit 7053867
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/ra-ui-materialui/src/input/AutocompleteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,13 @@ const AutocompleteInput: FunctionComponent<AutocompleteInputProps> = props => {

const handleChange = useCallback(
(item: any) => {
if (getChoiceValue(item) == null && filterValue) {
setFilterValue('');
}

input.onChange(getChoiceValue(item));
},
[getChoiceValue, input]
[filterValue, getChoiceValue, input]
);

// This function ensures that the suggestion list stay aligned to the
Expand Down

0 comments on commit 7053867

Please sign in to comment.