Open vinczemarton opened 5 years ago
For what it's worth, setting the subscription prop on FieldArray to an empty object helped me tremendously with this.
<FieldArray name="items" subscription={{}}>
This stackoverflow issue was what clued me in to this even being an option: https://stackoverflow.com/questions/53573160/performance-trouble-with-fieldarray-in-react-final-form
Any idea on this?
Are you submitting a bug report or a feature request?
Bug Report
What is the current behavior?
I'm using the form to create a large form (the size is mimics a real-life example form), that has a list of groups and elements in groups (Companies and Customers in each company).
Form significantly slows down with a large amount of elements.
What is the expected behavior?
The initial render should be much faster
Having a way to optimize the form so typing in fields is much faster (using DebounceInput is a possible hack)
Typing should not affect other fields (
validateFields={[]}
), therefore be fast.3./4. Having a way to making this significantly faster.
Removing a group should not even affect other groups, but since index is part of the key, every index shifts. Maybe I should skip using arrays and use opjects like:
Where 123 and 234 are generated keys that should not change between renders.
But this would require me to rewrite most array manipulations that is provided by final-form-arrays.
Sandbox Link
https://codesandbox.io/s/react-final-form-nested-arrays-validation-0bg0n
Original experiment contained a 20 Companies and 20 Customers in each but was reduced as it was starting to freeze and crash the browser.
What's your environment?
Chrome latest, newest available final-form packages in codesandbox.
Other information
Please help me optimize this simple example as much as possible, it would be a very good experiment in finding bottlenecks and best practices regarding final-form.
I'm also experimenting with collapsing certain sections of the form but that has other issues that I'm going to explain in an other ticket.