diff --git a/frontend/src/pages/Stats.tsx b/frontend/src/pages/Stats.tsx index 8e2f512..b487204 100644 --- a/frontend/src/pages/Stats.tsx +++ b/frontend/src/pages/Stats.tsx @@ -37,6 +37,7 @@ const StatPage = () => { const getStats = () => { setError(""); + setLoading(true); Promise.all([ axios.get("http://localhost:5000/stats/time"), @@ -78,7 +79,8 @@ const StatPage = () => { ); }) - .catch((e) => setError("Failed to load statistics: " + String(e))); + .catch((e) => setError("Failed to load statistics: " + String(e))) + .finally(() => setLoading(false)); }; const onSearch = () => { @@ -105,9 +107,7 @@ const StatPage = () => { }; useEffect(() => { - setLoading(true); getStats(); - setLoading(false); }, []) if (loading) return
Loading insights…
;