react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

"MUI: The value provided to Autocomplete is invalid." error on deselection

Open PawelSuwinski opened this issue 2 years ago • 1 comments

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

PawelSuwinski avatar Sep 20 '22 16:09 PawelSuwinski

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).

WiXSL avatar Sep 21 '22 14:09 WiXSL

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: obraz

PawelSuwinski avatar Sep 27 '22 10:09 PawelSuwinski

Reproduced. Thanks

WiXSL avatar Sep 27 '22 17:09 WiXSL

I am experiencing the same issue with react-admin 4.8.2

ns-vpanfilov avatar Mar 15 '23 02:03 ns-vpanfilov

is there any update on this? Facing this on 4.5.0.

mohammad-23 avatar Mar 22 '23 04:03 mohammad-23

@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.

slax57 avatar Mar 22 '23 08:03 slax57