fix: broken loading screen

This commit is contained in:
2026-02-02 15:43:09 +00:00
parent 291b6ed2aa
commit 2a54f863f4

View File

@@ -37,6 +37,7 @@ const StatPage = () => {
const getStats = () => { const getStats = () => {
setError(""); setError("");
setLoading(true);
Promise.all([ Promise.all([
axios.get("http://localhost:5000/stats/time"), 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 = () => { const onSearch = () => {
@@ -105,9 +107,7 @@ const StatPage = () => {
}; };
useEffect(() => { useEffect(() => {
setLoading(true);
getStats(); getStats();
setLoading(false);
}, []) }, [])
if (loading) return <p className="p-6">Loading insights</p>; if (loading) return <p className="p-6">Loading insights</p>;