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

Sync validation not triggered after reset #3284

Closed
HiroAgustin opened this issue Aug 2, 2017 · 8 comments
Closed

Sync validation not triggered after reset #3284

HiroAgustin opened this issue Aug 2, 2017 · 8 comments
Labels

Comments

@HiroAgustin
Copy link

HiroAgustin commented Aug 2, 2017

Bug Report

Sync validation is not triggered after a form is reset.

What is the current behavior?

  1. Focus on username field.
  2. Hit Tab.
  3. Error message is shown.
  4. Reset form.
  5. Focus on username field.
  6. Hit Tab.
  7. Error is not shown under the user field.

What is the expected behavior?

Sync validation should happen even tho the form was previously reset.

Sandbox Link

Reproduction Code

What's your environment?

  • Redux Form: 7.0.3
  • OS: macOS Sierra 10.12.6
  • Browser: Chrome 60

Other information

Looks very similar to #2838

@HiroAgustin HiroAgustin changed the title Field validation not triggered after reset Sync validation not triggered after reset Aug 2, 2017
@HiroAgustin
Copy link
Author

HiroAgustin commented Aug 2, 2017

Just updated the comment. After focusing out of the username field the second time (after the form has been reset) the error is not shown.

@danielrob danielrob added the bug label Aug 2, 2017
@asonni
Copy link

asonni commented Aug 2, 2017

I have the same problem with my own project 😞

@callmeberzerker
Copy link

Yep, same problem...

@slavik-m
Copy link

slavik-m commented Aug 2, 2017

Same behavior when mount/unmount form.

Current behavior:

1 Mounted form
2 Submit
3 Error message is shown
4 Unmount form (for example form in modal)
5 Mount form
6 Submit
7 Error is not shown under the user field and "redux-form/SET_SUBMIT_SUCCEEDED";
value is {};
props .dirty == false

@HiroAgustin
Copy link
Author

HiroAgustin commented Aug 2, 2017

A simple fix is having the reset button disabled if the form is pristine.
For some reason that solves it.

@json2d
Copy link
Contributor

json2d commented Aug 3, 2017

This one might be an easy fix: @@redux-form/UPDATE_SYNC_ERRORS should be dispatched after @@redux-form/RESET

state when form is first initialized
image

state diff after form is reset
image

as you can seee, form.fieldLevelValidation.syncErrors gets cleared

@danielrob
Copy link
Collaborator

Closing as a duplicate of #2971. This seems a legitimate bug, PR's welcomed!

@lock
Copy link

lock bot commented Aug 5, 2018

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 Aug 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants