-
-
Notifications
You must be signed in to change notification settings - Fork 362
doc(LoginTemplate): use ValidateForm in login form #6451
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
Conversation
Reviewer's GuideThis PR refactors the login samples to adopt the ValidateForm component uniformly, replacing ad-hoc input validation and click handlers with form-level validation callbacks and model binding. Class diagram for updated login form model usageclassDiagram
class LoginModel {
string? Email
string? Password
}
class Template1
class Template2
class Template3
class Template4
class Template5
Template1 --> LoginModel : uses
Template2 --> LoginModel : uses
Template3 --> LoginModel : uses
Template4 --> LoginModel : uses
Template5 --> LoginModel : uses
class ValidateForm {
+Model
+OnValidSubmit(EditContext)
}
Template1 --> ValidateForm : uses
Template2 --> ValidateForm : uses
Template3 --> ValidateForm : uses
Template4 --> ValidateForm : uses
Template5 --> ValidateForm : uses
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- Template5’s final “进入” button no longer has an event handler—add an OnClick or wrap it in a ValidateForm with OnValidSubmit to invoke your submit logic.
- Since you’re using ValidateForm, decorate LoginModel properties with DataAnnotations (e.g. [Required], [EmailAddress]) and remove SkipValidate so you can rely on built-in validation instead of manual flags.
- The OnSubmit handlers in Templates1–4 all just call StateHasChanged; consider extracting this repetitive logic into a shared base component or helper method to DRY up the code.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Template5’s final “进入” button no longer has an event handler—add an OnClick or wrap it in a ValidateForm with OnValidSubmit to invoke your submit logic.
- Since you’re using ValidateForm, decorate LoginModel properties with DataAnnotations (e.g. [Required], [EmailAddress]) and remove SkipValidate so you can rely on built-in validation instead of manual flags.
- The OnSubmit handlers in Templates1–4 all just call StateHasChanged; consider extracting this repetitive logic into a shared base component or helper method to DRY up the code.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6451 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 749 749
Lines 32359 32359
Branches 4571 4571
=========================================
Hits 32359 32359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6450
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Use ValidateForm for form validation and submission in all login templates to improve consistency and address issue #6450
Enhancements: