From 26d92afc48e75461441f58dd3ce13734ce75df4c Mon Sep 17 00:00:00 2001 From: Shargon Date: Sun, 18 May 2025 09:34:15 +0200 Subject: [PATCH 1/2] Update Toasts.razor.cs --- blazorbootstrap/Components/Toasts/Toasts.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blazorbootstrap/Components/Toasts/Toasts.razor.cs b/blazorbootstrap/Components/Toasts/Toasts.razor.cs index ae41e1328..dd1fee5c3 100644 --- a/blazorbootstrap/Components/Toasts/Toasts.razor.cs +++ b/blazorbootstrap/Components/Toasts/Toasts.razor.cs @@ -71,7 +71,7 @@ private async Task OnToastShownAsync(ToastEventArgs args) if (message is not null) Messages.Remove(message); - if (string.IsNullOrWhiteSpace(message!.ElementId)) + if (!string.IsNullOrWhiteSpace(message?.ElementId)) await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.toasts.hide", message.ElementId); } } From 5efc03b5abef2e608ea7f6e40b748d223c0e44aa Mon Sep 17 00:00:00 2001 From: Shargon Date: Sun, 18 May 2025 00:41:19 -0700 Subject: [PATCH 2/2] Update Toasts.razor.cs --- blazorbootstrap/Components/Toasts/Toasts.razor.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/blazorbootstrap/Components/Toasts/Toasts.razor.cs b/blazorbootstrap/Components/Toasts/Toasts.razor.cs index dd1fee5c3..f3d96dc78 100644 --- a/blazorbootstrap/Components/Toasts/Toasts.razor.cs +++ b/blazorbootstrap/Components/Toasts/Toasts.razor.cs @@ -69,10 +69,11 @@ private async Task OnToastShownAsync(ToastEventArgs args) foreach (var message in deleteMessages) { if (message is not null) + { Messages.Remove(message); - - if (!string.IsNullOrWhiteSpace(message?.ElementId)) - await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.toasts.hide", message.ElementId); + if (!string.IsNullOrWhiteSpace(message.ElementId)) + await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.toasts.hide", message.ElementId); + } } } }