-
-
Notifications
You must be signed in to change notification settings - Fork 503
fix(form-core): onSubmitInvalid
not called when canSubmit
false
#1697
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
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 15705d6
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1697 +/- ##
==========================================
+ Coverage 90.52% 90.53% +0.01%
==========================================
Files 37 37
Lines 1688 1690 +2
Branches 421 421
==========================================
+ Hits 1528 1530 +2
Misses 143 143
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
formApi: this, | ||
meta: submitMetaArg, | ||
}) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this ensures onSubmitInvalid
gets called, it happens before the submit validation. This means the formApi
will have a stale error state when the callback is triggered.
@kusiewicz It happens before the submit validation, but only in cases where If a user wanted to rerun validators even if |
Ok i got it. I just thought that there:
we should expect most recent errors, didn't know about |
well, they are the most recent errors. The most recent errors are preventing a submit altogether, so this PR asserts that attempting one should still trigger |
Hello @Pascalmh! I encountered the same issue mentioned by @kusiewicz. Calling Would you consider restructuring the logic to first perform the validation, check If it's okay with you, would it be possible for me to work on this and submit a PR? |
@jiji-hoon96 sure, if you want you can PR against my fork and I'll merge your changes in so they appear in this PR here - or you can create a new PR, whatever you prefere 👍 |
@jiji-hoon96 Are you sure it's stale? Even with |
Yes. I have confirmed its validity through testing. I may have made a mistake, so I would appreciate it if you could take a look at #1711 PR. |
I have submitted a pull request with some modifications to @Pascalmh`s work. |
…rm states Signed-off-by: Pascal Küsgen <[email protected]>
onSubmitInvalid
callback inFormApi
is called when a submission attempt is made whilecanSubmit
is falseFixes #1696