Conditionally visible FieldArrays pushing to wrong field
gidomanders opened this issue · 1 comments
gidomanders commented
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
I have 2 FieldArrays in bootstrap tabs based on routing, so the fields are displayed conditionally. The steps is the first field you see. When you add one step, it gets pushed to the steps array. When you switch tabs to questions and add a question, the question gets pushed to the steps array instead of the questions array.
What is the expected behavior?
I expect the question to be added to the questions array, so to the property the name refers to instead of the first field FieldArray is initialized with on window load.
Sandbox Link
https://codesandbox.io/s/youthful-wave-e4t0h
What's your environment?
- final-form: 4.18.7
- final-form-arrays: 3.0.2
- react: 16.12.0
- react-dom: 16.12.0
- react-final-form: 6.3.5
- react-final-form-arrays: 3.1.1
- react-router: 5.1.2
- react-router-dom: 5.1.2
- react-scripts: 3.0.1
- reactstrap: 8.4.1
gidomanders commented
Removing the Switch around the Route's in my component solved my problem.