Replies: 5 comments 22 replies
-
where is the codesandbox? |
Beta Was this translation helpful? Give feedback.
-
Hi @bluebill1049 I see you have looked into this: 3a275dd I ran a benchmark on master, looks like it's about 1.5 seconds faster. However it's still quite slow. We've eliminated the |
Beta Was this translation helpful? Give feedback.
-
This is definitely the issue, it's basically doing getValues twice,. |
Beta Was this translation helpful? Give feedback.
-
with getValues() * 2 (with 500 plus cells) this is the reason why. i would recommend investigating for a fix there. |
Beta Was this translation helpful? Give feedback.
-
We're running into something similar. The number of fields in our form is rather large (several hundred fields), though we only render a few fields at a time. It looks like this: Selecting an item in the tree on the left presents different fields on the right. We have one We're in the process of converting from Formik, which didn't have this particular performance problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So the shape of my form is like this:
so there are 368 checkboxes displaying.
I've got relative good performance in most interactions except one. To show my interactions, I'll start with a screenshot:
Interactions:
subarray[index].checkbox?
My approach is roughly like below:
the PerformanceHack there is to set the form dirty, because I can't set dirty on the
key
inside the checkbox onChange, it'll trigger re-render of all the checkboxes. Related code:This works fairly well, only the components I think should be updated are updated. However the checking / unchecking whole column is extreamly slow, >3 seconds without throttling
profiling react components gives me little information as most components did not render at all:
However, using the profiling tool from Chrome reveals there's a lot of time spent on some functions within react-hook-form: (4x cpu throttle applied this below screen capture)
Am I taking the right approach? or is there any room for optimisation inside the react-hook-form lib?
Thanks & Regards,
Beta Was this translation helpful? Give feedback.
All reactions