Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.1.4-beta02</Version>
<Version>10.1.4-beta03</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Button/Button.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
Expand Down Expand Up @@ -46,6 +46,7 @@ protected virtual async Task OnClickButton()
{
IsAsyncLoading = true;
IsDisabled = true;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

After setting IsAsyncLoading and IsDisabled to true, StateHasChanged() should be called to immediately update the UI before yielding control. This ensures the loading indicator and disabled state are rendered before the async operation continues. The PopConfirmButton component follows this pattern by calling StateHasChanged() immediately after setting these properties (see PopConfirmButton.razor.cs lines 100-101).

Suggested change
IsDisabled = true;
IsDisabled = true;
StateHasChanged();

Copilot uses AI. Check for mistakes.
await Task.Yield();
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

Consider applying this same pattern to other button components (LinkButton, ToggleButton) which also set IsAsyncLoading and IsDisabled when IsAsync is true but don't call Task.Yield(). This inconsistency means only the base Button component will prevent blocking the UI thread, while other async button types may still experience the original issue.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The addition of Task.Yield() should have test coverage to verify that it properly prevents UI thread blocking. Consider adding a test case in ButtonTest.cs that verifies the button's loading state is rendered before the async operation completes, ensuring the Task.Yield() behavior is working as intended.

Copilot uses AI. Check for mistakes.
}

await HandlerClick();
Expand Down