rjsf-team/react-jsonschema-form
View on GitHubForm values don't get reinitialized from defaults when toggling between anyOf/oneOf options
Open
#3736 opened on Jun 19, 2023
any-one-all-ofbugdefaultshelp wanted
Description
Prerequisites
- I have searched the existing issues
- I understand that providing a SSCCE example is tremendously useful to the maintainers.
- I have read the documentation
- Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
core
Version
5.x
Current Behavior
When one of the options from anyOf/oneOf is rendered, the default values get set properly. However, after you switch to a different option, then go back, all the defaults will be gone.
Expected Behavior
The defaults should get set every time someone changes the subschema version
Steps To Reproduce
- Go to https://rjsf-team.github.io/react-jsonschema-form/
- Click the "Any Of" example
- Notice that "First method of identification" is selected, and "First name" is set to the default value, "Chuck"
- In the render view, change to "Second method of identification"
- In the render view, change to "First method of identification"
Current: "First name" is empty Expected: "First name" is set to the default value, "Chuck"
Environment
- OS: Windows 11
- Node & npm: whatever you use on your playground