-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(LinkButton): support IsAsync function #6581
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 introduces asynchronous click support for LinkButton by refactoring the click handler into the base component (ButtonBase), enhancing OnClickButton to manage loading/disabled states when IsAsync is enabled, and updating unit tests to cover async behavior. Sequence diagram for LinkButton async click handlingsequenceDiagram
participant User as actor
participant LinkButton
participant ButtonBase
User->>LinkButton: Clicks button
LinkButton->>LinkButton: If IsAsync, set IsAsyncLoading/IsDisabled
LinkButton->>ButtonBase: HandlerClick()
ButtonBase->>ButtonBase: OnClickWithoutRender/OnClick
LinkButton->>LinkButton: If IsAsync, restore IsDisabled/IsAsyncLoading
Class diagram for updated ButtonBase and LinkButton async click supportclassDiagram
class ButtonBase {
+OnClickWithoutRender
+OnClick
+IsAsync
+IsNotRender
+HandlerClick()
}
class LinkButton {
+IsAsyncLoading
+IsDisabled
+IsKeepDisabled
+OnClickButton()
}
ButtonBase <|-- LinkButton
ButtonBase : +HandlerClick() (moved from Button)
LinkButton : +OnClickButton() (updated for async)
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 and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/Components/Button/LinkButton.cs:122` </location>
<code_context>
private async Task OnClickButton()
{
- if (OnClickWithoutRender != null)
+ if (IsAsync)
{
- await OnClickWithoutRender();
+ IsAsyncLoading = true;
+ IsDisabled = true;
}
</code_context>
<issue_to_address>
Async state management added before click handling.
Check if IsAsyncLoading and IsDisabled remain accurate if HandlerClick throws an exception or completes synchronously.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6581 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 721 721
Lines 31559 31562 +3
Branches 4450 4450
=========================================
+ Hits 31559 31562 +3
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 #6580
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable asynchronous click handling in LinkButton by introducing IsAsync with loading and disable state management, centralize click logic in ButtonBase, and update tests accordingly
New Features:
Enhancements:
Tests:
Chores: