From 807a462ac6a61228cdbcb78ea613be89a5b837f3 Mon Sep 17 00:00:00 2001 From: Sendou Date: Mon, 6 Jan 2020 13:31:52 +0200 Subject: [PATCH] crashing voting history fix --- frontend-react/src/components/plus/SummaryLists.js | 1 - frontend-react/src/components/plus/VotingHistory.js | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend-react/src/components/plus/SummaryLists.js b/frontend-react/src/components/plus/SummaryLists.js index 9fcf87a5d..1bb58a731 100644 --- a/frontend-react/src/components/plus/SummaryLists.js +++ b/frontend-react/src/components/plus/SummaryLists.js @@ -37,7 +37,6 @@ const summaryMap = summary => { } const SummaryLists = ({ summaries }) => { - console.log("summaries", summaries) const members = [] const suggested = [] diff --git a/frontend-react/src/components/plus/VotingHistory.js b/frontend-react/src/components/plus/VotingHistory.js index 19de169de..9614a1243 100644 --- a/frontend-react/src/components/plus/VotingHistory.js +++ b/frontend-react/src/components/plus/VotingHistory.js @@ -20,7 +20,14 @@ const VotingHistory = () => { } = useQuery(userLean) useEffect(() => { - if (loading || error || userQueryLoading || userQueryError) return + if ( + loading || + error || + userQueryLoading || + userQueryError || + !data.summaries + ) + return const monthsYears = data.summaries.reduce( (acc, cur) => { @@ -48,12 +55,12 @@ const VotingHistory = () => { setMonthChoices(monthsYears) }, [data, loading, error, userQueryLoading, userQueryError, userData]) + if (!loading && !data.summaries) return if (loading || userQueryLoading || monthChoices.length === 0) return if (error) return if (userQueryError) return if (!userData.user) return - if (!data.summaries) return const parts = forms.monthYear.split(" ") const month = months.indexOf(parts[0])