Closed shadow-identity closed 7 years ago
Hello!
this has been deliberately implemented that way. The reason is to guarantee that form(initialData).getValue() = form(form(initialData).getValue()).getValue()
, meaning that, using as initial data a value previously generated by the form, the new rendered form should be in the same state as the first one just before generating the data.
What do yo think? Why you need such behavior?
Hello! In my case schema can be changed sometimes and user should see new default values of new schema for his existing config.
Why do you think my PR corrupts this behavior with form(initialData).getValue() = form(form(initialData).getValue()).getValue()
?
it does, in your case, given that the properties are not required, the user could unselect the BAR
property and generate {"FOO":true}
, and then use this value as initial state. With your PR, then automatically BAR
will be selected to a true
value, giving a immediate output of {"FOO":true, "BAR":true}
.
If you give more details of your case maybe I can help you...
OK, thanks, now I'm understand.
Hi, it's me again ;)
I've fixed bug when Default values doesn't appear in whole form if some part of Initial Data exists
Say, we have schema:
And if we haven't Initial Data at all, form will be rendered with those default values. But if we have, say, only
{"BAR": true}
in Initial Data, the default values forFOO
will not be shown.It's because
getInitialValue(id)
will returnnull
in this case.This PR fixes it.