-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding item to field array mutates initialValue #627
Comments
This is working as designed. The |
🙈 I was looking for defaultValue, indeed. This is the second time I'm falling into this trap confusing initialValue and defaultValue. My bad. If I understand you correctly initialValue is only relevant for telling react with what initial value it should render uncontrolled html inputs. Is that correct? Would you be open to add JSDoc comments to these properties to get inline documentation via intellisense? Happy to open a PR (once I understand the difference precisely ofc 😸) |
I think many people will find it confusing to see both What do you need the |
For deriving state whether the user already submitted values before or not when loading the page in the context of an offline-first SPA. I don't necessarily need the defaultValue as part of the form context for that. I was just confused because I expected the initialValue to give me what I'm looking for. If I have time I'll look into providing a PR for adding JSDoc to the FormMetadata interface so that we would get inline documentation for all the properties. I have a feeling that I'm not the only one that is sometimes unclear about what all the form properties like |
Describe the bug and the expected behavior
When adding an item to a field array, conform automatically adds a new array with a value of type
undefined
to bothform.value
as well asform.initialValue
. I would not expect it to mutate the initialValue object before the form is actually successfully submitted.Conform version
v1.1.3
Steps to Reproduce the Bug or Issue
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: