Open chopfitzroy opened 1 month ago
@chopfitzroy Your second CodeSandbox isn't working for me. Can you check that it's shared publicly?
I expected this to work if we set the experimental_defaultFormStateBehavior to { allOf: 'populateDefaults' }
but that didn't work. Definitely a bug here. I think we have a few similar reports related to conditional logic, allOf, and computing default values.
@nickgros sorry about that! Link is public now.
Hi @heat!h-freenome, we are facing the same issue now and hope this can be fixed soon. when can we expect the fix? many thx!
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
Trying to use
default
values withdependencies
but theformData
does not update.Visually the form does update which is quite confusing for the user. Fortunately if the user tries to submit the validation does catch the error.
Interestingly if I use
if
/then
the issue presents the same but I do see warnings in the console, example here: https://codesandbox.io/p/sandbox/nagaozen-react-jsonschema-form-playground-forked-8g34z7 (this is different from the Codesandbox link below, please check both)A number of issues suggest that this may be to do with uncontrolled vs. controlled forms but I have tried with both.
These issues may also be tangentially related but it is hard to tell:
Expected Behavior
When changing from Cat to Fish I expect the
formData
to updatefood
from"meat"
to"worms"
.Steps To Reproduce
Example here: https://codesandbox.io/p/sandbox/nagaozen-react-jsonschema-form-playground-forked-t8f767
{food: 'meat', animal: 'Cat'}
{food: 'meat', water: 'sea', animal: 'Fish'}
NOTE: The inverse is also true if you start with Fish and then select Cat
food
will be"worms"
Environment
Anything else?
No response