Standardise loading state naming across dashboard hooks

This commit is contained in:
2026-04-21 19:12:43 +02:00
parent 094fb4fece
commit b3eb5dc6ec
9 changed files with 25 additions and 25 deletions

View File

@@ -27,7 +27,7 @@ export interface UseDashboardCountryDataResult {
/** Total ban count in the window. */
total: number;
/** True while a fetch is in flight. */
isLoading: boolean;
loading: boolean;
/** Error message or `null`. */
error: string | null;
/** Re-fetch the data immediately. */
@@ -54,7 +54,7 @@ export function useDashboardCountryData(
const [countryNames, setCountryNames] = useState<Record<string, string>>({});
const [bans, setBans] = useState<DashboardBanItem[]>([]);
const [total, setTotal] = useState<number>(0);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
const abortRef = useRef<AbortController | null>(null);
@@ -65,7 +65,7 @@ export function useDashboardCountryData(
const controller = new AbortController();
abortRef.current = controller;
setIsLoading(true);
setLoading(true);
setError(null);
fetchBansByCountry(timeRange, origin, source)
@@ -82,7 +82,7 @@ export function useDashboardCountryData(
})
.finally(() => {
if (!controller.signal.aborted) {
setIsLoading(false);
setLoading(false);
}
});
}, [timeRange, origin, source]);
@@ -94,5 +94,5 @@ export function useDashboardCountryData(
};
}, [load]);
return { countries, countryNames, bans, total, isLoading, error, reload: load };
return { countries, countryNames, bans, total, loading, error, reload: load };
}