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.5.0</Version>
<Version>10.5.1-beta01</Version>
</PropertyGroup>
Comment on lines 3 to 5
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The package version is changed to 10.5.1-beta01, but the PR description doesn’t mention a versioning/release intent. If this PR isn’t meant to publish a pre-release package, consider reverting this change; otherwise, document the reason for moving to a beta version in the PR description/release process notes.

Copilot uses AI. Check for mistakes.

<ItemGroup>
Expand Down
33 changes: 25 additions & 8 deletions src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,12 +1134,20 @@ protected async Task DeleteAsync()
{
await DynamicContext.DeleteAsync(SelectedRows.OfType<IDynamicObject>());
ResetDynamicContext();

// 触发删除回调方法
await TriggerDeleteCallback();

Comment on lines 1136 to +1140
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

In the DynamicContext branch, ResetDynamicContext() runs before TriggerDeleteCallback(). ResetDynamicContext() ultimately calls ResetSelectedRows(QueryItems), which can replace SelectedRows with an empty list once the deleted items are no longer present. As a result, OnAfterDeleteAsync may receive the wrong (often empty) set of deleted rows. Capture SelectedRows.ToList() before resetting, and pass that snapshot into the callback (or invoke the callback before ResetDynamicContext()).

Suggested change
ResetDynamicContext();
// 触发删除回调方法
await TriggerDeleteCallback();
// 触发删除回调方法
await TriggerDeleteCallback();
ResetDynamicContext();

Copilot uses AI. Check for mistakes.
Comment on lines +1138 to +1140
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

This PR changes behavior by firing OnAfterDeleteAsync/OnAfterModifyAsync in DynamicContext mode, but there doesn't appear to be a unit test asserting these callbacks are invoked (and with the expected deleted rows) for DynamicContext deletion. Adding a test alongside the existing DynamicContext_* Table tests would prevent regressions here.

Copilot uses AI. Check for mistakes.
SelectedRows.Clear();
await OnSelectedRowsChanged();
}
else if (IsExcel)
{
await InternalOnDeleteAsync();

// 触发删除回调方法
await TriggerDeleteCallback();

await QueryAsync();
}
else
Expand Down Expand Up @@ -1183,21 +1191,30 @@ async Task<bool> DeleteItemsAsync()
}
}
}
if (OnAfterDeleteAsync != null)
{
await OnAfterDeleteAsync(SelectedRows);
}
if (OnAfterModifyAsync != null)
{
await OnAfterModifyAsync();
}

// 触发删除回调方法
await TriggerDeleteCallback();

// 清空选中行
SelectedRows.Clear();
await QueryAsync();
}
return ret;
}
}

private async Task TriggerDeleteCallback()
{
if (OnAfterDeleteAsync != null)
{
await OnAfterDeleteAsync(SelectedRows);
}
if (OnAfterModifyAsync != null)
{
await OnAfterModifyAsync();
}
}

private void ResetDynamicContext()
{
if (DynamicContext != null)
Expand Down
Loading