From ac5890f1152490de877fbf76ba7e79a5c4e3d28d Mon Sep 17 00:00:00 2001 From: Moritz Deiaco Date: Thu, 30 May 2024 18:17:25 +0200 Subject: [PATCH] Fixed Loading Mistake --- Moonlight/Core/UI/Components/Cards/AdminUserCard.razor | 3 ++- .../Servers/UI/Components/Cards/AdminServersCard.razor | 3 ++- .../UI/Components/Cards/UserDashboardServerCount.razor | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Moonlight/Core/UI/Components/Cards/AdminUserCard.razor b/Moonlight/Core/UI/Components/Cards/AdminUserCard.razor index 3c77403d..95daa68d 100644 --- a/Moonlight/Core/UI/Components/Cards/AdminUserCard.razor +++ b/Moonlight/Core/UI/Components/Cards/AdminUserCard.razor @@ -13,6 +13,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { - UserCount = UserRepository.Get().Count(); + if (firstRender) + UserCount = UserRepository.Get().Count(); } } \ No newline at end of file diff --git a/Moonlight/Features/Servers/UI/Components/Cards/AdminServersCard.razor b/Moonlight/Features/Servers/UI/Components/Cards/AdminServersCard.razor index 0183eda0..20f70fa9 100644 --- a/Moonlight/Features/Servers/UI/Components/Cards/AdminServersCard.razor +++ b/Moonlight/Features/Servers/UI/Components/Cards/AdminServersCard.razor @@ -13,7 +13,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { - ServerCount = ServerRepository.Get().Count(); + if (firstRender) + ServerCount = ServerRepository.Get().Count(); } } \ No newline at end of file diff --git a/Moonlight/Features/Servers/UI/Components/Cards/UserDashboardServerCount.razor b/Moonlight/Features/Servers/UI/Components/Cards/UserDashboardServerCount.razor index 7983081f..056172e0 100644 --- a/Moonlight/Features/Servers/UI/Components/Cards/UserDashboardServerCount.razor +++ b/Moonlight/Features/Servers/UI/Components/Cards/UserDashboardServerCount.razor @@ -30,10 +30,11 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { - - ServerCount = await ServerRepository.Get().Where(x => x.Owner == IdentityService.CurrentUser).CountAsync(); - NetworksCount = await NetworkRepository.Get().Where(x => x.User == IdentityService.CurrentUser).CountAsync(); - + if (firstRender) + { + ServerCount = await ServerRepository.Get().Where(x => x.Owner == IdentityService.CurrentUser).CountAsync(); + NetworksCount = await NetworkRepository.Get().Where(x => x.User == IdentityService.CurrentUser).CountAsync(); + } } } \ No newline at end of file