From a28f847572543597b0a9dfa5ff399d67e9962e90 Mon Sep 17 00:00:00 2001 From: curo1305 Date: Fri, 17 Apr 2026 20:55:13 +0200 Subject: [PATCH] Reduce retry count and show errors on admin pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TanStack Query's default 3 retries + exponential backoff hid backend errors behind 5-8s of "Loading…". Now retries once and surfaces the error message immediately on failure. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/pages/AdminGroupsPage.tsx | 8 +++++++- frontend/src/pages/AdminUsersPage.tsx | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/AdminGroupsPage.tsx b/frontend/src/pages/AdminGroupsPage.tsx index f20d867..878470c 100644 --- a/frontend/src/pages/AdminGroupsPage.tsx +++ b/frontend/src/pages/AdminGroupsPage.tsx @@ -15,9 +15,10 @@ import { export default function AdminGroupsPage() { const queryClient = useQueryClient(); - const { data: groups = [], isLoading } = useQuery({ + const { data: groups = [], isLoading, isError, error } = useQuery({ queryKey: ["admin-groups"], queryFn: adminListGroups, + retry: 1, }); const [showForm, setShowForm] = useState(false); @@ -97,6 +98,11 @@ export default function AdminGroupsPage() { {isLoading ? (

Loading…

+ ) : isError ? ( +

+ Failed to load groups:{" "} + {(error as any)?.response?.data?.detail ?? (error as any)?.message ?? "Unknown error"} +

) : ( diff --git a/frontend/src/pages/AdminUsersPage.tsx b/frontend/src/pages/AdminUsersPage.tsx index fa6cb02..97cb929 100644 --- a/frontend/src/pages/AdminUsersPage.tsx +++ b/frontend/src/pages/AdminUsersPage.tsx @@ -13,9 +13,10 @@ import { export default function AdminUsersPage() { const queryClient = useQueryClient(); const { data: me } = useQuery({ queryKey: ["me"], queryFn: getMe }); - const { data: users = [], isLoading } = useQuery({ + const { data: users = [], isLoading, isError, error } = useQuery({ queryKey: ["admin-users"], queryFn: adminGetUsers, + retry: 1, }); const [showForm, setShowForm] = useState(false); @@ -71,6 +72,11 @@ export default function AdminUsersPage() { {isLoading ? (

Loading…

+ ) : isError ? ( +

+ Failed to load users:{" "} + {(error as any)?.response?.data?.detail ?? (error as any)?.message ?? "Unknown error"} +

) : (