From 6a127405094ce77047a5919277d278173a2b491b Mon Sep 17 00:00:00 2001 From: Thanasis Kapsalis Date: Wed, 17 Jul 2024 14:25:46 +0300 Subject: [PATCH 1/2] Fix taskCompletionSourceVariable that gets 'nulled' when a task is completed and a new one started imidietly. The issue occures in rare cases when the same dialogue used continously on same action and the tasklist is constantly refreshed without having room to dispose the object --- BlazorDialog/Components/Dialog.razor | 1 - .../IndexCommon.razor | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BlazorDialog/Components/Dialog.razor b/BlazorDialog/Components/Dialog.razor index 963b883..bbac20c 100644 --- a/BlazorDialog/Components/Dialog.razor +++ b/BlazorDialog/Components/Dialog.razor @@ -166,7 +166,6 @@ if (taskCompletionSource != null) { taskCompletionSource.SetResult(result); - taskCompletionSource = null; } }; } diff --git a/TestApps/BlazorDialog.TestAppsCommon/IndexCommon.razor b/TestApps/BlazorDialog.TestAppsCommon/IndexCommon.razor index 4ec72fc..a9ab203 100644 --- a/TestApps/BlazorDialog.TestAppsCommon/IndexCommon.razor +++ b/TestApps/BlazorDialog.TestAppsCommon/IndexCommon.razor @@ -129,14 +129,15 @@ - + @if (dialogResult != null) { -
DialogResult: @dialogResult
+
DialogResult: @dialogResult @((secondDialogResult != null) ? "and " + secondDialogResult : "")
} -@code{ +@code { string dialogResult = null; + string secondDialogResult = null; bool isCentered; DialogSize size; DialogAnimation animation; @@ -147,6 +148,16 @@ dialogResult = await dialogService.ShowDialog("simple-dialog", "(Simple Dialog) Are you sure?"); } + async Task SimpleDialogBackToBack() + { + dialogResult = await dialogService.ShowDialog("simple-dialog", "(Simple Dialog) Are you sure?"); + if (dialogResult == "no") + { + return; + } + secondDialogResult = await dialogService.ShowDialog("simple-dialog", "(Simple Dialog) Are you really sure?"); + } + async Task SimpleDialogBigOnClick() { dialogResult = await dialogService.ShowDialog("simple-large-dialog", "(Simple Dialog Large) Are you sure?"); From 2e645df7f990591b1b3294ab82e58f15d126b3db Mon Sep 17 00:00:00 2001 From: stavroskasidis Date: Wed, 17 Jul 2024 18:25:26 +0300 Subject: [PATCH 2/2] Version bump. Readme update --- BlazorDialog/BlazorDialog.csproj | 2 +- README.md | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BlazorDialog/BlazorDialog.csproj b/BlazorDialog/BlazorDialog.csproj index b8057cf..82b42e9 100644 --- a/BlazorDialog/BlazorDialog.csproj +++ b/BlazorDialog/BlazorDialog.csproj @@ -12,7 +12,7 @@ blazor blazor-component blazor-dialog dialog modal blazor-modal blazordialog blazormodaldialog blazormodal razor razor-components razorcomponents $(VersionSuffix) - 3.1.0 + 3.2.0 $(Version)-$(VersionSuffix) BlazorDialog diff --git a/README.md b/README.md index 1c0e945..0eff3dc 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,13 @@ Make sure that there is a call to `app.UseStaticFiles();` in your server project ## Release Notes -
3.1 +
3.2 + +>- Fix for a bug when the same dialog is presented consecutively, never returning result. Contributed by [thanoskapsalis](https://github.com/thanoskapsalis). +
+ + +
3.1 >- Added `ForceAllowNavigation` and `ForcePreventNavigation` methods to the `Dialog` component to allow/prevent navigation regardless of the `PreventNavigation` parameter.