From b88d3059e91c15373bf10b8ad3c88afb06464db3 Mon Sep 17 00:00:00 2001 From: Claudio Schaad Date: Sat, 7 Jun 2025 18:24:47 +0200 Subject: [PATCH] Hardly reload --- .../Components/Pages/Home.razor.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Schaad.Accounting.UI/Components/Pages/Home.razor.cs b/Schaad.Accounting.UI/Components/Pages/Home.razor.cs index 6d04486..f8ae71d 100644 --- a/Schaad.Accounting.UI/Components/Pages/Home.razor.cs +++ b/Schaad.Accounting.UI/Components/Pages/Home.razor.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using System.IO.Compression; +using System.IO.Compression; using Microsoft.AspNetCore.Components; using Microsoft.FluentUI.AspNetCore.Components; using Schaad.Accounting.Datasets; @@ -34,6 +33,9 @@ public partial class Home : ComponentBase [Inject] private ITransactionRepository transactionRepository { get; set; } = null!; + + [Inject] + private NavigationManager Navigation { get; set; } = null!; private List? matchingBankTransactions; private IReadOnlyList accounts = []; @@ -138,7 +140,7 @@ public partial class Home : ComponentBase } else if (message.Status == MessageStatus.Warning) { - ShowToast(text, ToastIntent.Warning); + await ShowMessageAsync(text, MessageIntent.Warning); } else if (message.Status == MessageStatus.Error) { @@ -164,7 +166,7 @@ public partial class Home : ComponentBase return; } transactionRepository.SaveTransaction(transaction); - matchingBankTransactions = viewService.MatchOpenBankTransactions(); + ReloadPage(); await Task.CompletedTask; } @@ -182,8 +184,14 @@ public partial class Home : ComponentBase var result = await dialog.Result; if (!result.Cancelled && result.Data != null) { - matchingBankTransactions!.RemoveAll(q => q == transaction); + ReloadPage(); await Task.CompletedTask; } } + + private void ReloadPage() + { + var uri = Navigation.Uri; + Navigation.NavigateTo(uri, forceLoad: true); // forceLoad = true does a full reload + } }