From 3c947ef6a31092c1487ccc0190d1a3a4118c7a97 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:32:29 -0500 Subject: [PATCH] Fix History component useEffect dependency array --- client/src/History.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/client/src/History.js b/client/src/History.js index 70c5bb9..b2d89c2 100644 --- a/client/src/History.js +++ b/client/src/History.js @@ -19,21 +19,20 @@ function History() { const [days, setDays] = useState(7); const [loading, setLoading] = useState(true); - const loadHistory = async () => { - setLoading(true); - try { - const response = await axios.get('/api/history/overview', { params: { days } }); - setHistoryData(response.data); - setLoading(false); - } catch (error) { - console.error('Error loading history:', error); - setLoading(false); - } - }; - useEffect(() => { + const loadHistory = async () => { + setLoading(true); + try { + const response = await axios.get('/api/history/overview', { params: { days } }); + setHistoryData(response.data); + setLoading(false); + } catch (error) { + console.error('Error loading history:', error); + setLoading(false); + } + }; + loadHistory(); - // eslint-disable-next-line react-hooks/exhaustive-deps }, [days]); if (loading) return