-
-
Notifications
You must be signed in to change notification settings - Fork 346
feat(IValidateComponent): update ToggleMessage return value as Task #6112
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
# Conflicts: # src/BootstrapBlazor/Components/Validate/IValidateComponent.cs # src/BootstrapBlazor/Components/Validate/ValidateBase.cs
Reviewer's GuideThis PR refactors validation messaging to be fully asynchronous by changing ToggleMessage to return Task, updating SetError methods to async, and awaiting all ToggleMessage calls across validation and form components. Sequence Diagram: Async ToggleMessage in ValidateForm.SetErrorsequenceDiagram
participant C as Caller
participant VF as ValidateForm
participant IVC as IValidateComponent
C->>+VF: SetError(expression, errorMessage)
Note over VF: Method signature changed to async Task
VF->>+VF: await InternalSetError(exp, errorMessage)
Note over VF: Method signature changed to async Task
VF->>-IVC: await ToggleMessage(results)
IVC-->>VF: Task (completed)
VF-->>C: Task (completed)
Sequence Diagram: Async ToggleMessage Call in Validation MethodssequenceDiagram
participant S as System/Event Trigger
participant VF as ValidateForm
participant IVC as IValidateComponent
S->>+VF: ValidateFieldAsync(context, results)
Note over VF: (or ValidateObject, ValidateProperty)
VF->>+IVC: await ToggleMessage(messages)
IVC-->>-VF: Task (completed)
VF-->>-S: Task (completed)
Updated Class Diagram for IValidateComponent and Asynchronous ValidationclassDiagram
direction LR
class IValidateComponent {
<<Interface>>
+Task ToggleMessage(IReadOnlyCollection~ValidationResult~ results)
}
class ValidateBase~TValue~ {
+Task ToggleMessage(IReadOnlyCollection~ValidationResult~ results)
}
ValidateBase --|> IValidateComponent
class UploadBase~TValue~ {
+Task ToggleMessage(IReadOnlyCollection~ValidationResult~ results)
}
UploadBase --|> ValidateBase
class InputUpload {
+Task ToggleMessage(IReadOnlyCollection~ValidationResult~ results)
}
InputUpload --|> UploadBase
class ValidateForm {
+Task SetError~TModel~(Expression~Func~TModel, object~~ expression, string errorMessage)
+Task SetError(string propertyName, string errorMessage)
-Task InternalSetError(MemberExpression exp, string errorMessage)
#Task ValidateObject(ValidationContext context, List~ValidationResult~ results)
#Task ValidateFieldAsync(ValidationContext context, List~ValidationResult~ results)
-Task ValidateProperty(ValidationContext context, List~ValidationResult~ results)
}
ValidateForm ..> IValidateComponent : uses
class MultiSelect {
-Task SetValue()
}
MultiSelect --|> ValidateBase
class MultiSelectGeneric {
-Task SetValue()
}
MultiSelectGeneric --|> ValidateBase
class Transfer {
-Task TransferItems(List~SelectedItem~ source, List~SelectedItem~ target)
}
Transfer --|> ValidateBase
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.
Pull Request Overview
This PR updates the ToggleMessage API to be asynchronous by changing its return type from void to Task and propagating async/await calls throughout the validation and upload components.
- Updated ToggleMessage signatures in IValidateComponent, ValidateBase, UploadBase, and related component files
- Modified SetError and validation workflows in ValidateForm and Transfer components to await ToggleMessage calls
- Bumped the package version in BootstrapBlazor.csproj
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs | Updated SetError and InternalSetError methods to use async/await with ToggleMessage calls |
src/BootstrapBlazor/Components/Validate/ValidateBase.cs | Changed virtual ToggleMessage to return Task and updated its implementation |
src/BootstrapBlazor/Components/Validate/IValidateComponent.cs | Modified interface method ToggleMessage to be asynchronous |
src/BootstrapBlazor/Components/Upload/UploadBase.cs | Updated ToggleMessage override to return Task with Task.CompletedTask return |
src/BootstrapBlazor/Components/Upload/InputUpload.razor.cs | Adjusted ToggleMessage implementation to be asynchronous |
src/BootstrapBlazor/Components/Transfer/Transfer.razor.cs | Changed ToggleMessage calls to be awaited in Transfer components |
src/BootstrapBlazor/Components/SelectGeneric/MultiSelectGeneric.razor.cs | Updated ToggleMessage call to await the asynchronous method |
src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs | Changed ToggleMessage calls to asynchronous usage |
src/BootstrapBlazor/BootstrapBlazor.csproj | Bumped version from 9.6.5-beta03 to 9.7.0 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6112 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 703 703
Lines 31019 31022 +3
Branches 4386 4386
=========================================
+ Hits 31019 31022 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Link issues
fixes #6111
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Convert validation message toggling to an asynchronous model by changing the ToggleMessage API to return Task and updating all related validation and error-handling methods to use async/await
Enhancements: