-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to switch between the options in the anyOf when omitExtraData and liveOmit is true #4367
Comments
I dug a bit, and it looks like the bug happens like this. Given the schema has a top-level default, which is the value of option 1. Some fields from option 1 and option 2 have default values as well.
Now the formData is mixed between option 1 and option 2 values, and the form thinks option 1 is still selected, hence the bug I think the expected behaviour should be that either the second onChange does not happen, or it happens in a way that includes only the defaults for the second option. |
👋 I can see the same issue without any default values {
"additionalProperties": false,
"properties": {
"any_of_array_or_null": {
"anyOf": [
{
"items": {
"type": "integer"
},
"type": "array",
"title": "Array value selected"
},
{
"type": "null",
"title": "Null value selected"
}
]
}
},
"required": [
"any_of_array_or_null"
],
"type": "object"
} Screen.Recording.2024-11-07.at.17.01.43.movMy guess is that it's a conflict between a default |
I made an attempt at fixing this here #4375 |
I am also dealing with this issue. I have a schema that I would like to use RJSF with but the schema contains numerous |
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
I have a schema that has anyOf between two options. The form renders a selector for it, but when I use the selector to select the options, it does not work. I also notice when I select the option 2 for example, the formData is filled with default of both option 1 and option 2.
When turning off omitExtraData and liveOmit, it works normally.
Expected Behavior
When I switch to option 2, the fields for option 2 should be rendered, and the formData contains only the default values for option 2
Steps To Reproduce
Visit playground, and try to use the selector to select option 2. You will notice the fields for option 1 still render and the formData includes the default values for both option 1 and option 2
Environment
Anything else?
The schema I'm testing with
The text was updated successfully, but these errors were encountered: