Skip to content

Conditionally visible FieldArrays pushing to wrong field #142

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

Closed
gidomanders opened this issue Jul 16, 2020 · 1 comment
Closed

Conditionally visible FieldArrays pushing to wrong field #142

gidomanders opened this issue Jul 16, 2020 · 1 comment

Comments

@gidomanders
Copy link

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 gidomanders changed the title Conditional FieldArrays pushing to wrong field Conditionally visible FieldArrays pushing to wrong field Jul 16, 2020
@gidomanders
Copy link
Author

Removing the Switch around the Route's in my component solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant