-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useField pass a validate function will cause Infinite loops #44
Comments
Find another solution: Put the validate function declaration outside the render function.But if someone doesn't know the internal implementation of useField, they might make the same mistake as me |
@chenjigeng thanks for reporting it. I created the PR including validation at field level. Today we have discovered the bug ourselves iov-one/ponferrada#160 I do not have too much free time these days, I will take a look and fix it as soon as I can. Thanks! |
@chenjigeng ☝️ ☝️ ☝️ |
* fix: validator infinite loops fixes #44 * test: update useField test
Published fix in |
Are you submitting a bug report or a feature request?
bug report
Sandbox Link
https://codesandbox.io/s/m38k650n79
See the console.
Other information
I see the source code of useField and find the reason.
In react function, every render will product new validate function.So it will cause this problem. Although we can use useCallback to avoid it.But it's so hard to use for user.Can we use useCallback in the inner or something else to solve this.
The text was updated successfully, but these errors were encountered: