fix(ui): exit infinite spinner with a retry card on failed initial load

List pages wrapped content in <Spin spinning={!fetched}> where 'fetched' only flipped true once data arrived. With staleTime: Infinity + retry: 1, a transient network error on first load left the query in a permanent error state and the spinner stuck forever.

Now 'fetched' also settles on query.isError, and a failed load shows a Result error card with a Refresh button that self-heals when the backend returns, mirroring the existing XrayPage pattern. Applied to clients, inbounds, groups, nodes, and the dashboard.

Fixes #4723
This commit is contained in:
MHSanaei committed 2026-06-01 07:43:32 +02:00 Unverified
1 parent dd14e9b3b0
commit b9cbc0c1e8
9 files changed
+60 -9

No files matched your search

+3 -1
View File
@@ -76,6 +76,8 @@ export function useNodesQuery() {
nodes,
totals,
loading: query.isFetching,
fetched: query.data !== undefined,
fetched: query.data !== undefined || query.isError,
fetchError: query.error ? (query.error as Error).message : '',
refetch: query.refetch,
};
}
+2 -1
View File
@@ -30,7 +30,8 @@ export function useStatusQuery() {
return {
status,
fetched: query.data !== undefined,
fetched: query.data !== undefined || query.isError,
fetchError: query.error ? (query.error as Error).message : '',
refresh,
};
}
+3 -1
View File
@@ -213,7 +213,8 @@ export function useClients() {
const total = listQuery.data?.total ?? 0;
const filtered = listQuery.data?.filtered ?? 0;
const allGroups = listQuery.data?.groups ?? [];
const fetched = listQuery.data !== undefined;
const fetched = listQuery.data !== undefined || listQuery.isError;
const fetchError = listQuery.error ? (listQuery.error as Error).message : '';
const loading = listQuery.isFetching;
const inbounds = inboundOptionsQuery.data ?? [];
@@ -532,6 +533,7 @@ export function useClients() {
onlines,
loading,
fetched,
fetchError,
subSettings,
ipLimitEnable,
tgBotEnable,
Loaded 3 of 9 files, more files were not shown because too many files have changed in this diff. Show more