-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Supporting async validation in createServerValidate
#855
Supporting async validation in createServerValidate
#855
Conversation
TypeScript type implementation was referenced from the following code: form/packages/form-core/src/FormApi.ts Lines 44 to 64 in 75d25dd
|
Thanks for the PR! Looks good so far but let's doublecheck, have you tested also with validator adapters like zod? Could you also write some unit tests for that? |
@Balastrong
Looking forward to your guidance! |
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.
The PR is already ok, if you want to add more tests for valibot and yup it'd be great!
Tests on types are also welcome, up to you if you want to make them on this branch or on a new PR later.
Thank you!
@Balastrong |
I'll take care of that and merge then, thanks! :) |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 606e988. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
Changes
Currently, server-side validation cannot be performed asynchronously. This is particularly inconvenient when using external validation adapters like Zod to check database values against form inputs.
Client-side validation can already be performed asynchronously, and since server-side operations are generally expected to be asynchronous, the impact of this change should be minimal.
validatorAdapter().validate()
tovalidatorAdapter().validateAsync()
onServerValidate
property is not supported forvalidatorAdapter
(Ex. Zod) TypeScirpt typesSample Code