Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
PawelSuwinski opened this issue Sep 20, 2022 · 6 comments · Fixed by #8788
Closed

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

PawelSuwinski opened this issue Sep 20, 2022 · 6 comments · Fixed by #8788
Labels

Comments

@PawelSuwinski
Copy link

PawelSuwinski commented Sep 20, 2022

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 PawelSuwinski changed the title "MUI: The value provided to Autocomplete is invalid." error on undo selection "MUI: The value provided to Autocomplete is invalid." error on deselection Sep 20, 2022
@WiXSL
Copy link
Contributor

WiXSL commented Sep 21, 2022

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

@PawelSuwinski
Copy link
Author

PawelSuwinski commented Sep 27, 2022

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

@WiXSL WiXSL added bug and removed needs more info labels Sep 27, 2022
@WiXSL
Copy link
Contributor

WiXSL commented Sep 27, 2022

Reproduced.
Thanks

@ns-vpanfilov
Copy link

I am experiencing the same issue with react-admin 4.8.2

@mohammad-23
Copy link

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

@slax57
Copy link
Contributor

slax57 commented Mar 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants