diff --git a/Pkmds.Web/Components/Pages/Home.razor.cs b/Pkmds.Web/Components/Pages/Home.razor.cs index de7922ae..2065b630 100644 --- a/Pkmds.Web/Components/Pages/Home.razor.cs +++ b/Pkmds.Web/Components/Pages/Home.razor.cs @@ -10,7 +10,11 @@ protected override void OnInitialized() RefreshService.OnUpdateAvailable += ShowUpdateMessage; } - public void Dispose() => RefreshService.OnAppStateChanged -= StateHasChanged; + public void Dispose() + { + RefreshService.OnAppStateChanged -= StateHasChanged; + RefreshService.OnUpdateAvailable -= ShowUpdateMessage; + } public void ShowUpdateMessage() { diff --git a/Pkmds.Web/Program.cs b/Pkmds.Web/Program.cs index 8c48c829..986c15b9 100644 --- a/Pkmds.Web/Program.cs +++ b/Pkmds.Web/Program.cs @@ -12,14 +12,14 @@ }); services - .AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }) + .AddSingleton(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }) .AddFileSystemAccessService() - .AddScoped() - .AddScoped() - .AddScoped() - .AddScoped() - .AddScoped() - .AddScoped(); + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton(); var app = builder.Build();