Performance issue, adding spinner while validating #11949
-
Version Number7.51.5 (latest) The Codehttps://stackblitz.com/edit/chakra-ui-react-hook-form-demo?file=src%2Fcomponents%2FForm.tsx Steps to reproduceClick Submit button The problemIn my real project i have somewhat same size form as in this example, 20+ inputs, mostly uncontrolled and UI done with Chakra. The problem that i'm facing is that when i submit the form and the validation starts, it takes several seconds to validate the fields and sometimes it seems like the UI is frozen and unresponsive. If you check the console of the example, you can see that every field is re-rendered multiple times, is this the correct behaviour? I've also tried to show a spinner while the validation process is ongoing, but the isValidating state is changed on every input validate, so it wont stay true for the whole validation process. Thank you in advance. Screen.Recording.2024-05-29.at.22.26.21.mov |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Nostalginen, Here's the better day to do it. Things to note:
|
Beta Was this translation helpful? Give feedback.
Hi @Nostalginen,
Here's the better day to do it.
https://stackblitz.com/edit/chakra-ui-react-hook-form-demo-spr2eh
Things to note:
https://react-hook-form.com/docs/usecontroller/controller
https://react-hook-form.com/advanced-usage
https://v2.chakra-ui.com/docs/components/number-input