final-form / final-form

🏁 Framework agnostic, high performance, subscription-based form state management

Home Page:https://final-form.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Field Arrays Issue

The-Code-Monkey opened this issue · comments

Bug Report.

What is the current behavior?

If using Field inside of FieldArrays inside of FieldArrays, every time i type in the fields it causes all the FieldArrays to re-render which causes major lag and causes you to lose focus of the field.

What is the expected behavior?

It should use more of a hook based system to check whether it has updated the Field rather than the whole FieldArray, the only time FieldArray should re-render is if the length of fields increases or decreases.

What's your environment?

Lastest final-form, final-form-field-arrays, and chrome

If i am correct this was one of the issues you said that final-form was supposed to fix from reduxForm, also why does it need to register each field this seems like a useless step to me but that might just be my misunderstanding.

Are you using subscriptions? I am using Field in FieldArray (not nested like yours) with only length subscription and the FieldArray does not re-render. Also, I've specified validateFields={[]} to prevent other fields from re-rendering

My Field looks like

                    <Field<string>
                        name="Name"
                        validate={validateName}
                        validateFields={[]}
                        subscription={{
                            validating: true,
                            value: true,
                            touched: true,
                            error: true,
                            submitError: true,
                        }}
                        render={({ input, meta }) => {

Can you create a gist?