Skip to content
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 level validation must revalidate on component re-register. #3500

Closed
theKashey opened this issue Oct 10, 2017 · 6 comments
Closed

Field level validation must revalidate on component re-register. #3500

theKashey opened this issue Oct 10, 2017 · 6 comments
Labels
c:field-level-validation validation in field component

Comments

@theKashey
Copy link

Are you submitting a bug report or a feature request?

It is a bug

What is the current behavior?

If you will change validation rule (or any other prop) Field will re-register itself.

What is the expected behavior?

It will re-register itself and continue behave as it might behave.

What's your environment?

7.0.4

Other information

The bug is quite simple -
I have form with 2 fields: The A and The B.
Validation Rule is simple: B must be equal A. And this is field level validation.

Then I'v change A it will call validation of B and display "SYNC_ERROR". Just after it I will provide a new validation function for B, and Field will de-register itself, wiping all the errors, and register back.

But this point it might call validation again, but it will not.
In other words - then I am providing a new field validation function to a Field - it must be called.

@HarrisGri
Copy link

HarrisGri commented Dec 20, 2017

I experience the same issue.

I have a field that is connected to a Country selection field. Which means, every time somebody changes a country the other field, that is connected to the Country selection will rerender and update his validators. Because depending on the selection the other field has to validate the postal_code depending on the country regulation.

What currently happen's
After the user selects an another payment country the field that is listening to that change is going to be rerendered and the validate will be updated with the new validate functions (redux-form will perform a redux-form/UNREGISTER_FIELD then redux-form/REGISTER_FIELD).

What happens after Unregister/Register is that all syncErrors are gone and the fields are marked as valid.

Before selection with touched fields:

screen shot 2017-12-20 at 14 19 09

After country change:
screen shot 2017-12-20 at 14 17 59

@danielrob
Copy link
Collaborator

Sandbox https://codesandbox.io/s/20635p081y

@atsu85
Copy link

atsu85 commented May 9, 2018

Shouldn't this be closed, now that #3909 is merged?

@danielrob
Copy link
Collaborator

@atsu85 as soon as 7.4.0 is released.

@erikras
Copy link
Member

erikras commented Jun 12, 2018

Fix released in v7.4.0.

@erikras erikras closed this as completed Jun 12, 2018
@lock
Copy link

lock bot commented Jun 12, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c:field-level-validation validation in field component
Projects
None yet
Development

No branches or pull requests

5 participants