question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Destroy then initialize does not respect validation on consecutive submissions

See original GitHub issue

I have an edit profile page with a simple name/email/password form. Let’s say the user changes their name, then hits save. If they then change their name again and hit save, it won’t validate anything (i.e., they can submit a blank name which is supposed to be required, or a password under the minimum length, etc.)

I’m handling side effects using redux-saga, so I call startSubmit, stopSubmit, and destroy separately.

However, after this form is destroyed, I do an initialize with the server’s responded values to re-initialize it.

For some reason, destroy gets rid of validation. How do I initialize after the destroy, and pass validation to it? My handleSubmit (which is declared via onSubmit in the reduxForm method in the component) still works fine, but validation does not.

Again, validation works fine on first submission. But after destroy, it doesn’t work any longer.

So, to diagram this flow:

1. User enters fields and clicks save.
2. Form validates input
3. Form submits
4. I intercept with onSubmit and manually call startSubmit
5. If successful, I call stopSubmit.
6. Then I call destroy.
7. Then I call initialize.
8. User changes fields and clicks save again.
9. Form validates input but does not respect it (aka I can log from my validate method and see it's being called, but the form ignores the errors and submits anyway).
10. Form submits

Number 10 should not happen.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bndniocommented, Dec 6, 2017

Any update on this? I’m experience the same issue on version 7.1.2 using React 15.6.2 and Redux 3.7.2. Where after calling destroy, the form will submit regardless of if there are any syncErrors sitting in the form state

0reactions
erikrascommented, Mar 30, 2018

For all of you using redux-saga, perhaps check out this tool I just built to convert actions into a Promise for libraries like redux-form.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Destroy then initialize does not respect validation on ... - GitHub
I have an edit profile page with a simple name/email/password form. Let's say the user changes their name, then hits save.
Read more >
Init(args) - The practical DI framework - Unity Forum
Init (args) is a toolset that makes it possible to pass arguments to Objects from the outside during initialization.
Read more >
respect validation translation issue - Stack Overflow
Now I'm using respect validation version 2.2 and in this version there is no setParam function for error object.
Read more >
Build settings reference | Apple Developer Documentation
A detailed list of individual Xcode build settings that control or change the way a target is built.
Read more >
Configuring and managing high availability clusters Red Hat ...
Node failures in a high availability cluster are not visible from clients ... You can then stop the Apache service on one node...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found