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>9.8.0-beta07</Version>
<Version>9.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 7 additions & 9 deletions src/BootstrapBlazor/Components/Dialog/Dialog.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class Dialog : IDisposable
[NotNull]
private Func<Task>? _onCloseAsync = null;

private readonly Dictionary<Dictionary<string, object>, (bool IsKeyboard, bool IsBackdrop)> DialogParameters = [];
private readonly Dictionary<Dictionary<string, object>, (bool IsKeyboard, bool IsBackdrop, Func<Task>? OnCloseCallback)> DialogParameters = [];
private Dictionary<string, object>? _currentParameter;
private bool _isKeyboard = false;
private bool _isBackdrop = false;
Expand Down Expand Up @@ -72,16 +72,14 @@ private async Task Show(DialogOption option)

_onCloseAsync = async () =>
{
// Callback OnCloseAsync
if (option.OnCloseAsync != null)
{
await option.OnCloseAsync();
}

// Remove current DialogParameter
if (_currentParameter != null)
{
DialogParameters.Remove(_currentParameter);
DialogParameters.Remove(_currentParameter, out var v);
if (v.OnCloseCallback != null)
{
await v.OnCloseCallback();
}

// Support for multiple dialogs
var p = DialogParameters.LastOrDefault();
Expand Down Expand Up @@ -162,7 +160,7 @@ private async Task Show(DialogOption option)
_currentParameter = parameters;

// Add ModalDialog to the container
DialogParameters.Add(parameters, (_isKeyboard, _isBackdrop));
DialogParameters.Add(parameters, (_isKeyboard, _isBackdrop, option.OnCloseAsync));
await InvokeAsync(StateHasChanged);
}

Expand Down