You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the chrome devtools inspector in the code sandbox link.
Rapidly type in input inside any of the <input /> fields, like Name or Description.
Observe that the value of isValidating is updated onChange, rather than on blur or after the user has finished typing in input. (Value of isValidating is being console logged out on line 31).
Expected behaviour
The Max Update Depth Exceeded error does not occur on the code sandbox link but you can see that the isValidating flag is being updated too often in the example. This is a problem in more data-intensive applications like the one in which this error was discovered, where it also causes unacceptable lag when filling out the form inputs. When I revert to a previous version of react-hook-form that does not contain this bug, the expected behavior is to politely wait until the user has finished typing input to revalidate (or onBlur, onTouched, or the specified mode). Specifically, the excessive re-renders cause an issue for the use of the isValidating flag to determine whether the submit button should be disabled, which we are doing in the vast majority of our forms.
Based on my research and experimentation, I believe the offending commit is in 7.51.1.
What browsers are you seeing the problem on?
Chrome
Relevant log output
chunk-4SMLELHS.js?v=b1477510:521 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.printWarning @chunk-4SMLELHS.js?v=b1477510:521error @chunk-4SMLELHS.js?v=b1477510:505checkForNestedUpdates @chunk-4SMLELHS.js?v=b1477510:19693scheduleUpdateOnFiber @chunk-4SMLELHS.js?v=b1477510:18561dispatchSetState @chunk-4SMLELHS.js?v=b1477510:12423next @react-hook-form.js?v=ea906d14:1858next @react-hook-form.js?v=ea906d14:878_updateIsValidating @react-hook-form.js?v=ea906d14:1123executeBuiltInValidation @react-hook-form.js?v=ea906d14:1262await in executeBuiltInValidation (async) onChange @react-hook-form.js?v=ea906d14:1410await in onChange (async) callCallback2 @chunk-4SMLELHS.js?v=b1477510:3674invokeGuardedCallbackDev @chunk-4SMLELHS.js?v=b1477510:3699invokeGuardedCallback @chunk-4SMLELHS.js?v=b1477510:3733invokeGuardedCallbackAndCatchFirstError @chunk-4SMLELHS.js?v=b1477510:3736executeDispatch @chunk-4SMLELHS.js?v=b1477510:7016processDispatchQueueItemsInOrder @chunk-4SMLELHS.js?v=b1477510:7036processDispatchQueue @chunk-4SMLELHS.js?v=b1477510:7045dispatchEventsForPlugins @chunk-4SMLELHS.js?v=b1477510:7053(anonymous) @chunk-4SMLELHS.js?v=b1477510:7177batchedUpdates$1 @chunk-4SMLELHS.js?v=b1477510:18941batchedUpdates @chunk-4SMLELHS.js?v=b1477510:3579dispatchEventForPluginEventSystem @chunk-4SMLELHS.js?v=b1477510:7176dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @chunk-4SMLELHS.js?v=b1477510:5478dispatchEvent @chunk-4SMLELHS.js?v=b1477510:5472dispatchDiscreteEvent @chunk-4SMLELHS.js?v=b1477510:5449
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Version Number
7.51.1
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/laughing-cori-3fcn9m?file=%2Fsrc%2FApp.js%3A11%2C32
Steps to reproduce
<input />
fields, like Name or Description.isValidating
is updated onChange, rather than on blur or after the user has finished typing in input. (Value ofisValidating
is being console logged out on line 31).Expected behaviour
The Max Update Depth Exceeded error does not occur on the code sandbox link but you can see that the
isValidating
flag is being updated too often in the example. This is a problem in more data-intensive applications like the one in which this error was discovered, where it also causes unacceptable lag when filling out the form inputs. When I revert to a previous version ofreact-hook-form
that does not contain this bug, the expected behavior is to politely wait until the user has finished typing input to revalidate (or onBlur, onTouched, or the specifiedmode
). Specifically, the excessive re-renders cause an issue for the use of theisValidating
flag to determine whether the submit button should be disabled, which we are doing in the vast majority of our forms.Based on my research and experimentation, I believe the offending commit is in 7.51.1.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: