Nested Fields can cause issues (FieldArray > Field > Field)
See original GitHub issueAre you submitting a bug report or a feature request?
I think it could be a bug, but perhaps I am doing something that is not intended.
What is the current behavior?
I have a scenario where I have a FieldArray
with a Field
, that has a Field
as child. The idea is that we only show the maxLength
field if the parent isList
field is true
. Sorry, for the sudo-code here, but this is an example of the nesting:
<FieldArray name="options">
{({ fields }) => {
{fields.map((name, index) => (
<div>
<Field name={`${name}.title`} component="Input" />
<Field name={`${name}.isList`} type="checkbox"}>
{({input, meta}) => (
<div>
{input.isList ? (
<Field name={`${name}.maxLength`} component="Input />
)
: (<div>foo</div>)
}
</div>
)}
</Field>
</div>
)}
}
</FieldArray>
The fields all work fine this way, however when using move
as provided from the FieldArray
’s fields
property, it results in an error:
fields.move(0, 1)

What is the expected behavior?
Fields would move, and the form would not explode.
Sandbox Link
At the default state, click the massively oversized “Move” button.
https://codesandbox.io/s/32p402x3om
What’s your environment?
"final-form": "4.10.0",
"final-form-arrays": "1.1.0",
"react": "16.4.0",
"react-dom": "16.4.0",
"react-final-form": "3.6.5",
"react-final-form-arrays": "1.0.6",
"styled-components": "3.3.2"
Other information
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Nested fieldarray in formik - Stack Overflow
You problem is in how you pass the name for the component: name={`${itineraries[index].itinerary[idx]}.overnight`}.
Read more >Object Fields VS. Nested Field Types in Elasticsearch - Opster
Too many nested objects could cause performance degradation or mapping explosion. Use flattened field type to map all keyword fields of an inner...
Read more >useFieldArray - Simple React forms validation
Custom hook for working with Field Arrays (dynamic form). ... for nested field array, you will have to cast the field array by...
Read more >Working with nested data - Splunk Documentation
Extract and promote a nested field to a top-level field. ... Flattening fields with such nested data can make extracting data easier.
Read more >Field Names - Final Form Docs
Field names are strings that allow dot-and-bracket syntax, allowing you to create arbitrarily deeply nested fields. There are four main things you need...
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
Thanks @lukeschunk . I could edit it, but I guess I will leave it to forever memorialize my mistake.
Please fix this…it’s killing me slowly…