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 not triggered after reset #2838
Comments
Hello there @bbenezech! Where did u got that sandbox from ? I certainly can reproduce the behavior on it, but I can't do it on the codesanbox provided in the docs: https://codesandbox.io/s/PNQYw1kVy perhaps someone screwed up while setting it up ? |
@irvingv8 The only difference is the absence of validation on I looked at the conditionals in |
Ok! I Believe I fixed it! I'll submit a pull request, will be my first contribution to OSS <3! hopefully I did it well, even though this was an easy one |
@erikras is there any guide/steps on how to contribute to redux-forms? It was little bit hard for me to get to test what i modified, I find the rebuild examples script, but it was going over all of the examples taking a LOT of time to rebuild each of them and I just wanted to test a single one. I ended up deleting all the other examples, running the script and testing... Maybe the script could take the name of a example to rebuild ? |
I actually ran into this exact issue myself a while back. Really appreciate the PR, and I'm willing to help get this moved along! You probably want to add a test here. Specifically, something like One question I have: I'm wondering about the order of things happening.
It seems the correct fix would lie in making either |
Ty for the guidance @timhwang21, now that you mention it, it totally makes sense, I went straight to the fact that syncErrors was out of the state right after the reset, but you are right, there is something more to it as it only happens when the non validated field is the one populated. I'll take another shot at it in a couple of hours and see if I can get to culprit of the trouble. And about:
values -> initialValues was already there. |
Sure, what I meant is that values and errors are being populated at the same time in reset. Validation happens on the new values AFTER reset. The errors you are propagating are the errors from BEFORE reset. Hence any new errors caused by the reset won't be saved. Though, in the edge case at play here, if the reset causes errors then set validation would probably be called anyways. So it might work but strikes me as an indirect solution. There was a PS from the last release that changes accessing errors from props to a property set on this, I had to stop digging but it seems this may be a regression due to that fix. |
Good news, guys. I found the bug. This was a tricky one. |
Would be great If you could share some details, I'd like to get started helping people on this repo, sorry for the Pull Request, It was my first time looking at the core. Is there any way I can contact you if I have any doubts about it ? |
Published fix as @irvingv8 Twitter or email (see |
This is still not working, no action for UPDATE_SYNC_ERROR is being dispatched & no validation occurs. |
I confirm, the problem is not solved yet, after the reset, verification is not carried out.. p.s. v6.8.0 |
@arman-mukatov could you provide a codesanbox sample to test ? I can no longer reproduce this issue with 6.8.0 |
I have this same problem using version |
I won't re-open this bug because the original reproduction sandbox + repro steps do not work against the same sandbox upgraded to 7.0.3. If you are still experiencing an issue like this, please create a new formal issue report. |
I am having same problem... validation does not work after reset form... |
Same problem happening here. We have an edit mode and read only mode and have an issue with resetting the form. for now we found a workaround: This is working, since initialize will trigger the validation p.s. may require |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Very easy to reproduce:
https://codesandbox.io/s/o22j1lOZB
Modify age, then reset, then modify age, then submit.
Field validation on
Username
andEmail
are bypassed.UPDATE_SYNC_ERRORS
is not triggered after reset like it is when a validated field is dirty.It looks like the conditions
updateSyncErrorsIfNeeded
are incorrects.This is a major issue IMO. I have no easy workaround.
@erikras I know you must be terribly busy but can you have a look?
The text was updated successfully, but these errors were encountered: