From f11f8e2e1a2bfe36e879e8dde038ef87bd100fbd Mon Sep 17 00:00:00 2001 From: Mu7ammadAbed Date: Fri, 3 Jul 2020 23:21:02 +0300 Subject: [PATCH] Fix useEffect Bug --- client/src/components/Charts/pageviewReport.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/components/Charts/pageviewReport.js b/client/src/components/Charts/pageviewReport.js index caa67ea6..4fdedc30 100644 --- a/client/src/components/Charts/pageviewReport.js +++ b/client/src/components/Charts/pageviewReport.js @@ -31,7 +31,7 @@ const PageviewsReport = () => { setReportData(newReportData); }; - useEffect(async () => { + const reactAppView = async () => { const { REACT_APP_VIEW_ID } = await getSecrets(); const request = { viewID: REACT_APP_VIEW_ID, @@ -58,6 +58,10 @@ const PageviewsReport = () => { }), 1000 ); + }; + + useEffect(() => { + reactAppView(); }, [startDate, endDate]); return (