-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Field validation still broken in 7.0.1 #3218
Comments
Possibly more information here: #3172 |
I found the solution to the problem in #3211. The validate function needs to stay the same accross renders (ie: not a lambda generated in the render function, not an array formed directly in the render function). |
hi @erikras , is this a final decision? In our code we have a function which return the validation per field, like: <Field validate={[validate('gender')]} /> After the changes in v7 this doesn't work properly, as on each render the validation is updated. In case we want to go with v7, this forces us to define validation in the Any chance that the project would go to the old behaviour? Regards, |
@PavelPolyakov see #3211 (comment). You could also memoize this function. |
@danielrob |
@PavelPolyakov not sure I follow. Memoize will cache the resulting validate function yes, as long as 'gender' doesn't change in your case. But the result of the resulting validation function each time the field value changes certainly shouldn't be cached! |
I have fix it by declaring my validation function outside my React Component like this:
The following did NOT work in v7.0.3 and resulted in UNREGISTER_FIELD / REGISTER_FIELD actions being dispatched:
|
@m19 @danielrob |
@PavelPolyakov EDIT: Pretty certain this is because |
I find myself wishing that there were a way to determine if two JS functions have all the same closure variables. It would solve this problem |
If you are hitting this issue, please see #4017 |
The validate function is correctly called, but even if it returns a string, the
meta.valid
,meta.invalid
andmeta.error
are not updated.It is working in 6.8.0, not working in 7.0.0 and 7.0.1
EDIT: I'm seeing
@@redux-form/UNREGISTER_FIELD
/@@redux-form/REGISTER_FIELD
actions passing when I unfocus the field. I don't see them in 6.8.0. The problem is probably coming from thereThe text was updated successfully, but these errors were encountered: