-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
feat(form-core): Validation on first and consequent attempts #1286
base: main
Are you sure you want to change the base?
feat(form-core): Validation on first and consequent attempts #1286
Conversation
…on first-submission and consequent submissions
View your CI Pipeline Execution ↗ for commit 9559bc1.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1286 +/- ##
==========================================
+ Coverage 88.32% 88.83% +0.51%
==========================================
Files 27 28 +1
Lines 1199 1272 +73
Branches 315 333 +18
==========================================
+ Hits 1059 1130 +71
- Misses 125 127 +2
Partials 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks for the PR! However I'm not entirely sure this is the right direction. I see it quite confusing to define a submit validator and then a flag to have a different validator... only if it's the first attempt.
What approach are we covering with this new api? |
That's totally fair. I honestly think that checking submission attempts and defining a behaviour for validation would be quite verbose and this proves to be an alternative. React Hook Form has a similar API as mentioned in the issue referenced. However, if you think that this kind of an option is not required in the tanstack-form, that would be understandable. |
? this.options.validationOnFirstAttempt ?? 'submit' | ||
: this.options.validationOnConsequentAttempts ?? 'submit'; |
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.
for me something like validationType and revalidationType sound more intuitive
Enables functionality like:
This is in reference with issue #1272
All kinds of criticism, API-related edits, structural edits, etc. are welcome!
The current approach is quite verbose and adds an option in the
formOptions
that could be attributed to an object. However, since I don't know what we can attribute it to, keeping this style of options open.Let me know if the functionality seems ok and we can work on documentation/writing tests.