react-admin
react-admin copied to clipboard
"MUI: The value provided to Autocomplete is invalid." error on deselection
What you were expecting:
Case of autocomplete on reference input with paging data provider. Initial list shows only limited, first page of fetched data. Autocomplete query filter reload the list. Deselecting selected value should restore initial state (empty value and initial first page list) without any warnings.
Example of usage:
<ReferenceInput {...props} defaultValue="">
<AutocompleteInput
filterToQuery={(searchText) => ({ title: searchText })}
optionText="title"
/>
</ReferenceInput>
What happened instead:
If selected value is from out of first page deselecting of it will restore the initial state but also raise a warning rised on the console, for example:
MUI: The value provided to Autocomplete is invalid.
None of the options match with `{"id":12,"title":"Qui tempore rerum et v(...)
Environment
- React-admin version: 4.4.3
- React version: ^17.0.0 | ^18.0.0
- Browser: Firefox
Thanks for reporting this. Please provide a sample application showing the issue by forking the following CodeSandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple).
Here it is: https://codesandbox.io/s/broken-leftpad-knxqnl
Steps:
- click "+" to create new comment
- click on post autocomplete drop-down list
- type "Sed" and select last listed item or filter and select any post outside of the initial list
- deselect selected post
See the console:
Reproduced. Thanks
I am experiencing the same issue with react-admin 4.8.2
is there any update on this? Facing this on 4.5.0.
@mohammad-23 you're right this has been open for too long. We'll try to take some time to address this issue within the next 2 weeks.