Skip to content

fix(PopConfirmButton): parameter IsKeepDisabled not work#7319

Merged
ArgoZhang merged 3 commits intomainfrom
fix-pop
Dec 13, 2025
Merged

fix(PopConfirmButton): parameter IsKeepDisabled not work#7319
ArgoZhang merged 3 commits intomainfrom
fix-pop

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 13, 2025

Link issues

fixes #7318

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

Bug Fixes:

  • Ensure PopConfirmButton restores its disabled state based on the IsKeepDisabled parameter after a confirm click instead of unconditionally enabling it.

Copilot AI review requested due to automatic review settings December 13, 2025 02:08
@bb-auto bb-auto Bot added the bug Something isn't working label Dec 13, 2025
@bb-auto bb-auto Bot added this to the v10.1.0 milestone Dec 13, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Dec 13, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

PopConfirmButton’s confirm-click handler is updated so that the button’s disabled state after confirmation respects the IsKeepDisabled parameter instead of always re-enabling the button; other referenced files appear to have no functional changes in this diff.

Sequence diagram for PopConfirmButton confirm click behavior with IsKeepDisabled

sequenceDiagram
    actor User
    participant PopConfirmButton
    participant ConfirmCallback

    User->>PopConfirmButton: ClickConfirm()
    PopConfirmButton->>PopConfirmButton: OnClickConfirm()
    PopConfirmButton->>ConfirmCallback: Invoke confirm callback
    alt ConfirmCallback succeeds
        ConfirmCallback-->>PopConfirmButton: Success
        PopConfirmButton->>PopConfirmButton: IsDisabled = IsKeepDisabled
        PopConfirmButton->>PopConfirmButton: IsAsyncLoading = false
        PopConfirmButton->>PopConfirmButton: StateHasChanged()
    else ConfirmCallback fails
        ConfirmCallback-->>PopConfirmButton: Failure
        PopConfirmButton->>PopConfirmButton: IsDisabled = IsKeepDisabled
        PopConfirmButton->>PopConfirmButton: IsAsyncLoading = false
        PopConfirmButton->>PopConfirmButton: StateHasChanged()
    end
Loading

Updated class diagram for PopConfirmButton confirming disabled behavior

classDiagram
    class PopConfirmButton {
        bool IsDisabled
        bool IsKeepDisabled
        bool IsAsyncLoading
        OnClickConfirm() Task
    }
Loading

File-Level Changes

Change Details Files
Ensure PopConfirmButton respects the IsKeepDisabled parameter after a confirm click instead of always clearing the disabled state.
  • Update the confirm-click handler to set IsDisabled based on the IsKeepDisabled parameter rather than hard-coding it to false when the pop confirm closes
  • Leave IsAsyncLoading reset to false and trigger a component re-render via StateHasChanged after the confirm action completes
src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7318 Ensure that PopConfirmButton respects the IsKeepDisabled parameter after asynchronous confirmation completes (i.e., IsDisabled state after OnClickConfirm follows IsKeepDisabled instead of always becoming enabled).

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

@ArgoZhang ArgoZhang merged commit 904fd36 into main Dec 13, 2025
6 of 8 checks passed
@ArgoZhang ArgoZhang deleted the fix-pop branch December 13, 2025 02:08
Copy link
Copy Markdown
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 there - I've reviewed your changes - here's some feedback:

  • The assignment IsDisabled = IsKeepDisabled appears to invert the intended behavior of the IsKeepDisabled parameter; if the goal is to keep the button disabled when IsKeepDisabled is true, consider using IsDisabled = IsKeepDisabled ? true : false (or IsDisabled = IsKeepDisabled || IsDisabled depending on prior state) and explicitly clarifying the logic against the component’s expected semantics.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The assignment `IsDisabled = IsKeepDisabled` appears to invert the intended behavior of the `IsKeepDisabled` parameter; if the goal is to keep the button disabled when `IsKeepDisabled` is true, consider using `IsDisabled = IsKeepDisabled ? true : false` (or `IsDisabled = IsKeepDisabled || IsDisabled` depending on prior state) and explicitly clarifying the logic against the component’s expected semantics.

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.98%. Comparing base (33256b8) to head (763d193).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7319   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         746      746           
  Lines       32561    32561           
  Branches     4500     4500           
=======================================
  Hits        32556    32556           
  Misses          1        1           
  Partials        4        4           
Flag Coverage Δ
BB 99.98% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 fixes a bug where the IsKeepDisabled parameter was not functioning correctly in the PopConfirmButton component. Previously, after an async operation completed, the button would always become enabled again by hardcoding IsDisabled = false. Now it properly respects the IsKeepDisabled parameter, allowing buttons to remain disabled after async operations when desired.

Key Changes

  • Fixed button disabled state handling to respect IsKeepDisabled parameter after async operations
  • Updated documentation in both English and Chinese localization files to clarify the IsKeepDisabled parameter usage
  • Version bump to 10.1.4-beta05

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs Changed line 114 from hardcoded IsDisabled = false to IsDisabled = IsKeepDisabled, aligning behavior with other button implementations
src/BootstrapBlazor/BootstrapBlazor.csproj Version bump from 10.1.4-beta04 to 10.1.4-beta05 for the bug fix release
src/BootstrapBlazor.Server/Locales/zh-CN.json Added documentation explaining the IsKeepDisabled parameter functionality in Chinese
src/BootstrapBlazor.Server/Locales/en-US.json Added documentation explaining the IsKeepDisabled parameter functionality in English

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

else
{
IsDisabled = false;
IsDisabled = IsKeepDisabled;
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IsKeepDisabled functionality lacks test coverage in PopConfirmButton. While Button has test coverage for this feature (ButtonTest.cs lines 223-231), PopConfirmButton does not. Consider adding a test case to verify that when IsAsync and IsKeepDisabled are both true, the button remains disabled after the async operation completes.

Copilot uses AI. Check for mistakes.
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.

fix(PopConfirmButton): parameter IsKeepDisabled not work

2 participants