Data from top level fields with same name as nested fields is cloned
See original GitHub issueBug, Feature, or Question?
Bug
Current Behavior
When a nested field object with same name as a root one changes, all the properties from top level field are copied to the nested field.
Example:
<Form>
<Field name="user[name]">
<Field name="user[lastName]">
<Field name="nested[user][moreData]">
</Form>
Result
{
user: {
name: 'John',
lastName: 'Doe'
},
nested: {
user: {
name: 'John', // is copied from root on moreData change
lastName: 'Doe', // is copied from root field on moreData change
moreData: 123
}
}
}
Desired Behavior
Data from top level fields with same name as nested fields should not be copied.
Suggested Solutions
Additional Information
I also tried with dot notation with same results.
- Formik Version: “^0.11.11”
- React Version: “^16.2.0”
- TypeScript Version:
- CodeSandbox Link: https://codesandbox.io/s/3vrk45xjzp
- OS: macOS Sierra 10.12.6
- Node Version: v8.4.0
- Package Manager and Version: yarn v1.3.2
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Specify nested and repeated columns in table schemas
To create a column with nested data, set the data type of the column to RECORD in the schema. A RECORD can be...
Read more >3 Ways to Clone Objects in JavaScript | SamanthaMing.com
Because objects in JavaScript are references values, you can't simply just copy using the = . But no worries, here are 3 ways...
Read more >Nested field type | Elasticsearch Guide [8.5] | Elastic
The nested type is a specialised version of the object data type that allows arrays of objects to be indexed in a way...
Read more >Find a value in multiple nested fields with the same name in ...
I'm trying to make a query that can find all documents with a given value in the field name across the different second...
Read more >Methods for deep cloning objects in JavaScript - LogRocket Blog
A question that arises here is copying deeply nested objects up to, say, two or three levels deep in such a way that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am having this same issue with nested
<FieldArray>
sIt works! Thanks!