-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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 support validateOnly
#42273
Conversation
() => { | ||
setSubmittable(true); | ||
}, | ||
() => { |
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.
感觉第二个参数放进 catch 更直观一点
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.
这边是为了防止开发者在 then 里搞了花活导致失败,这么写方便复制过去。
form.validateFields({ validateOnly: true })
.then(() => {
// 花活结果搞挂了,会传到下面的 catch 里,以为是校验失败了
throw new Error(...);
}).catch(() => { ... });
size-limit report 📦
|
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## feature #42273 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 619 619
Lines 10570 10570
Branches 2886 2886
=========================================
Hits 10570 10570 ☔ View full report in Codecov by Sentry. |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
resolve #41801
💡 Background and solution
📝 Changelog
validateFields
supportvalidateOnly
to not to update UI status.validateFields
支持validateOnly
配置仅做校验而不改变 UI 状态。☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 434a06e
This pull request enhances the Form component by adding a new demo and updating the documentation for the
validateFields
method. It also updates therc-field-form
dependency to the latest version.🔍 Walkthrough
🤖 Generated by Copilot at 434a06e
validateOnly
option of thevalidateFields
method (link, link, link, link){ validateOnly?: boolean }
parameter for thevalidateFields
method and its version availability (link, link)rc-field-form
inpackage.json
to use the latest features of the form library (link)