final-form / react-final-form-arrays

A component for rendering and editing arrays 🏁 React Final Form
MIT License
205 stars 70 forks source link

Conditionally-rendered FieldArray does not render children if fields.push() is called on initialise #123

Open jvke opened 4 years ago

jvke commented 4 years ago

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

Conditionally-rendered FieldArrays do not re-render when fields.push() is called manually.

https://codesandbox.io/s/react-final-form-field-arrays-28hnd/

What is the expected behavior?

fields.push() should result in fields prop changing, and a re-render occurring.

Sandbox Link

Type in the Company field to render the FieldArray. Delete what you typed, and type something again, and it will work as it should. https://codesandbox.io/s/react-final-form-field-arrays-28hnd/

What's your environment?

Final Form 4.18.6 Final Form Arrays 3.0.2 React Final Form 6.3.3 React Final Form Arrays 3.1.1

Hyokune commented 4 years ago

Has anyone figured out a workaround for this issue?

ViktorAksionov commented 3 years ago

This issue exist already a whole year and still there is no fix for that?

I really do not want to go back to redux-form where FieldArray works fine =(

ViktorAksionov commented 3 years ago

Has anyone figured out a workaround for this issue?

The only way right now to fix it is to call fields.push() in setTimeout but that is dirty hack.

kyleroberthammond commented 1 year ago

Damn.