From b9683973dcc6b84e7be6385d1123b58cdd271a43 Mon Sep 17 00:00:00 2001 From: ferishili Date: Tue, 4 Jun 2024 14:04:46 +0200 Subject: [PATCH 1/2] proper async call to fetch user info in statistics, fixes #566 --- src/components/statistics/Statistics.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/statistics/Statistics.tsx b/src/components/statistics/Statistics.tsx index b3153d7902..8a105a82cb 100644 --- a/src/components/statistics/Statistics.tsx +++ b/src/components/statistics/Statistics.tsx @@ -7,6 +7,7 @@ import Header from "../Header"; import Footer from "../Footer"; import MainNav from "../shared/MainNav"; import TimeSeriesStatistics from "../shared/TimeSeriesStatistics"; +import { addNotification } from "../../slices/notificationSlice"; import { getStatistics, hasStatistics as getHasStatistics, @@ -46,10 +47,9 @@ const Statistics: React.FC = () => { useEffect(() => { // fetch user information for organization id, then fetch statistics -// @ts-expect-error TS(7006): Parameter 'e' implicitly has an 'any' type. - fetchUserInfo().then((e) => { + dispatch(fetchUserInfo()).then(() => { dispatch(fetchStatisticsPageStatistics(organizationId)).then(); - }); + }) // eslint-disable-next-line react-hooks/exhaustive-deps }, []); From ad00a2cd2ac3c84f35586fc63dd3a3631e693282 Mon Sep 17 00:00:00 2001 From: ferishili Date: Tue, 4 Jun 2024 14:29:30 +0200 Subject: [PATCH 2/2] remove addNotification import --- src/components/statistics/Statistics.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/statistics/Statistics.tsx b/src/components/statistics/Statistics.tsx index 8a105a82cb..f89427ec99 100644 --- a/src/components/statistics/Statistics.tsx +++ b/src/components/statistics/Statistics.tsx @@ -7,7 +7,6 @@ import Header from "../Header"; import Footer from "../Footer"; import MainNav from "../shared/MainNav"; import TimeSeriesStatistics from "../shared/TimeSeriesStatistics"; -import { addNotification } from "../../slices/notificationSlice"; import { getStatistics, hasStatistics as getHasStatistics,