fix: admin pages stuck on infinite loading - reset data fields when auth transitions
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m36s
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m36s
Symptoms: After login, admin pages showed loading spinner forever. Root cause:
OnInitializedAsync in 11 admin pages (Dashboard, Blog, Inquiries, Clients,
Announcements, FAQs, TaxProfiles, ConsultingActivities, TaxFilingSchedules,
Contracts, RevenueTrackings) checked AuthStateTask and loaded data only if
authState.User.Identity?.IsAuthenticated == true. If that condition was ever
false (e.g., transient auth state resolution timing), the page never reset
its data collection from null → []. AdminDataPanel uses "Loading={item == null}"
as its loading predicate, so null persisted indefinitely.
Fix: Always reset the data collection, whether the auth check passes or fails:
- AuthStateTask != null && IsAuthenticated == true: load data (existing)
- AuthStateTask != null && IsAuthenticated == false: set data = [] (new else)
- AuthStateTask == null: set data = [] (new else)
This ensures AdminDataPanel's "Loading" condition becomes false on all code
paths, not just the success case.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,14 @@
|
||||
{
|
||||
await LoadAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
announcements = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
announcements = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,14 @@
|
||||
{
|
||||
await LoadPosts();
|
||||
}
|
||||
else
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,14 @@
|
||||
{
|
||||
await LoadAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
clients = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clients = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,14 @@
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
activities = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activities = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,6 +176,14 @@ else
|
||||
await LoadData();
|
||||
PrepareCreate();
|
||||
}
|
||||
else
|
||||
{
|
||||
contracts = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contracts = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +185,17 @@
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// AuthorizeRouteView already gates this page, so this branch is
|
||||
// only a transient auth-state resolution timing gap - but without
|
||||
// resetting isLoading here, AdminDataPanel would spin forever.
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,14 @@
|
||||
{
|
||||
await LoadAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
faqs = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
faqs = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,14 @@
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
revenues = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
revenues = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,14 @@ else
|
||||
await LoadData();
|
||||
PrepareCreate();
|
||||
}
|
||||
else
|
||||
{
|
||||
schedules = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
schedules = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,14 @@ else
|
||||
await LoadData();
|
||||
PrepareCreate();
|
||||
}
|
||||
else
|
||||
{
|
||||
profiles = [];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profiles = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user