Closed skorphil closed 9 months ago
Works fine in storybook
After audit in rect dev tools profiler, i noticed 2 causes of this
I think further tweaking may help (creating an external form provider or excluding formState
from context)
For now lower the priority, cause the main problem was in use-hook-form devtools were enabled
Fix everything by excluding unnecessary formStates:{dirtyFields}
from children components
Again not working after some refactoring https://www.reddit.com/r/react/comments/1b0jhii/usehookform_rerenders_component_without_any/
Got bug with rerendering of RecordForm after these changes https://github.com/skorphil/nextjs-form/commit/22a67fec42e40c16edbd5b62de6343423c0e18cb
{ watch } = useForm()
re-rendered root component RecordForm
, causing horrible performance. While utilising useWatch()
allowed to re-render only component which is using it
Reddit thread: https://www.reddit.com/r/react/comments/1b0jhii/comment/ks897ms/?context=3
useWatch docs: https://react-hook-form.com/docs/usewatch
Inputs on mobile slowly respond to user input. lag