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

Cannon read property '_error' of undefined #2272

Closed
reznord opened this issue Dec 12, 2016 · 4 comments
Closed

Cannon read property '_error' of undefined #2272

reznord opened this issue Dec 12, 2016 · 4 comments

Comments

@reznord
Copy link

reznord commented Dec 12, 2016

So, I had to set enableReinitalize to true for solving the issue mentioned in #621 .

Now when I set the enableReinitalize: true , the validate function doesn't work for some reason. It throws an error saying Cannot read property '_error' of undefined which prevents from opening the form where we enabled enableReinitalize: true.

The screenshot of the error -
error after setting enableReinitalize: true

The example code for the form page is https://gist.github.com/reznord/eb0e50539dc72484b7d446f7b8141280

Any ideas on how to fix this?

@erikras
Copy link
Member

erikras commented Dec 12, 2016

You're gonna kick yourself.

.

.

Ready?

.

.

You can't return undefined from validate(). You need to swap lines 98 and 99, so the return errors is outside of the if block.

That said, it would behoove the library itself to default undefined to {} as a response from validate(). So I will look into that....

@reznord
Copy link
Author

reznord commented Dec 12, 2016

@erikras cool, thanks for that. That was a silly mistake !! 😅

@erikras
Copy link
Member

erikras commented Dec 23, 2016

Fix published in v6.4.0.

@lock
Copy link

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

No branches or pull requests

2 participants