react-hook-form: issue: Default value doesn't work with mui select

Version Number

7.17.5

Codesandbox/Expo snack

https://codesandbox.io/s/react-hook-form-mui-5-6jg6f?file=/src/index.js

Steps to reproduce

When loading the CSB, the select value that should be filled in is blank. The following error is presented in the console “MUI: You have provided an out-of-range value [object Object] for the select” . Until version 7.15.3, the same code worked normally.

Expected behaviour

Load values when starting or resetting the component .

What browsers are you seeing the problem on?

Firefox, Chrome, Edge

Relevant log output

No response

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

I would see to provide a workaround solution and close this issue. This is expected behavior for RHF.

I posted a solution above

We cloud make a page on rhf, that has the purpose of outlining some tips for the different UI component libs, like MUI, so information, that is for the specific UI lib, is something people can read easily if they choose to use a specific one.

Maybe worth logging an issue in MUI and see for the reason behind such logic. it’s a raw object until they have some property methods but not in those cases with a standard object.