Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Apr 25, 2025

Link issues

fixes #5863

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Remove unnecessary Task.Run usage in button component event callbacks

Bug Fixes:

  • Eliminate potential unnecessary threading overhead in button click event handlers

Enhancements:

  • Streamline asynchronous event handling in Button, PopConfirmButton, and CountButton components

Chores:

  • Simplify button component event handling by removing redundant Task.Run calls

* fix(Button):修复WPF Blazor模式下Button组件IsAsync不工作

* chore: bump version beta03

Co-Authored-By: zglp <[email protected]>

---------

Co-authored-by: zglp <[email protected]>
Co-authored-by: Argo Zhang <[email protected]>
Co-authored-by: zglp <[email protected]>
# Conflicts:
#	src/BootstrapBlazor/BootstrapBlazor.csproj
#	src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 25, 2025

Reviewer's Guide by Sourcery

This pull request removes the use of Task.Run in the event callbacks of the Button, PopConfirmButton, and CountButton components. The change simplifies the event handling logic by directly awaiting the asynchronous operations.

Sequence diagram for Button click event

sequenceDiagram
    participant Button
    participant Handler

    Button->>Handler: HandlerClick()
    activate Handler
    Handler-->>Button: Task
    deactivate Handler
Loading

Sequence diagram for PopConfirmButton confirm event

sequenceDiagram
    participant PopConfirmButton
    participant OnConfirm

    PopConfirmButton->>OnConfirm: OnConfirm()
    activate OnConfirm
    OnConfirm-->>PopConfirmButton: Task
    deactivate OnConfirm
Loading

Sequence diagram for CountButton click event

sequenceDiagram
    participant CountButton
    participant Handler

    CountButton->>Handler: HandlerClick()
    activate Handler
    Handler-->>CountButton: Task
    deactivate Handler
    CountButton->>CountButton: UpdateCount()
    activate CountButton
    CountButton-->>CountButton: Task
    deactivate CountButton
Loading

File-Level Changes

Change Details Files
Removed Task.Run from event callbacks in Button, PopConfirmButton, and CountButton components.
  • Removed Task.Run from the OnClickButton method in Button.razor.cs.
  • Removed Task.Run from the OnClickConfirm method in PopConfirmButton.razor.cs.
  • Removed Task.Run from the OnClickButton method in CountButton.cs.
src/BootstrapBlazor/Components/Button/Button.razor.cs
src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs
src/BootstrapBlazor/Components/Button/CountButton.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#5863 The IsAsync property of the Button component should correctly display a loading state and disable the button while an asynchronous operation is in progress in a WPF Blazor application.
#5863 Clicking the button rapidly should not cause the counter to increment uncontrollably while the button is in an asynchronous loading state.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added the bug Something isn't working label Apr 25, 2025
@bb-auto bb-auto bot added this to the v9.5.0 milestone Apr 25, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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:

Overall Comments:

  • Consider adding a comment explaining why Task.Run was removed from the event callbacks.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang merged commit 6b39b6a into main Apr 25, 2025
4 checks passed
@ArgoZhang ArgoZhang deleted the chore-button branch April 25, 2025 05:23
@codecov
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9f0d084) to head (b2eefd6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5891   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          661       661           
  Lines        30430     30421    -9     
  Branches      4323      4321    -2     
=========================================
- Hits         30430     30421    -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Button): 再wpf blazor模式下, button 的 IsAsync 不工作

2 participants