Skip to content

Commit f015fd3

Browse files
authored
Merge pull request #932 from mapswipe/fix/user-dasboard-null
Fix/user dasboard
2 parents adcb1b2 + 8019ecb commit f015fd3

File tree

2 files changed

+9
-8
lines changed
  • community-dashboard/app

2 files changed

+9
-8
lines changed

community-dashboard/app/components/ItemSelectInput/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ function ItemSelectInput<Name extends string>(props: ItemSelectInputProps<Name>)
274274
},
275275
});
276276
}, [
277-
variables,
278277
fetchMoreUser,
279278
fetchMoreUserGroup,
280279
userData?.users.offset,

community-dashboard/app/views/UserGroupDashboard/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,24 @@ function UserGroupDashboard(props: Props) {
298298
setDateRange(newValue ?? defaultDateRange);
299299
}, [setDateRange]);
300300

301-
const totalSwipes = userGroupStats?.userGroupStats.stats.totalSwipes;
302-
const totalSwipesLastMonth = userGroupStats?.userGroupStats.statsLatest.totalSwipes;
301+
const totalSwipes = userGroupStats?.userGroupStats?.stats?.totalSwipes ?? 0;
302+
const totalSwipesLastMonth = userGroupStats?.userGroupStats?.statsLatest?.totalSwipes ?? 0;
303303

304-
const totalSwipeTime = userGroupStats?.userGroupStats.stats.totalSwipeTime;
305-
const totalSwipeTimeLastMonth = userGroupStats?.userGroupStats.statsLatest.totalSwipeTime;
304+
const totalSwipeTime = userGroupStats?.userGroupStats?.stats?.totalSwipeTime ?? 0;
305+
// eslint-disable-next-line max-len
306+
const totalSwipeTimeLastMonth = userGroupStats?.userGroupStats?.statsLatest?.totalSwipeTime ?? 0;
306307

307-
const totalContributors = userGroupStats?.userGroupStats.stats.totalContributors;
308-
const totalContributorsLastMonth = userGroupStats?.userGroupStats.statsLatest.totalContributors;
308+
const totalContributors = userGroupStats?.userGroupStats?.stats?.totalContributors ?? 0;
309+
// eslint-disable-next-line max-len
310+
const totalContributorsLastMonth = userGroupStats?.userGroupStats?.statsLatest?.totalContributors ?? 0;
309311

310312
const filteredStats = filteredUserGroupStats?.userGroupStats?.filteredStats;
311313

312314
return (
313315
<Page
314316
className={className}
315317
variant="userGroup"
316-
heading={userGroupStats?.userGroup.name}
318+
heading={userGroupStats?.userGroup?.name}
317319
totalSwipes={totalSwipes}
318320
totalSwipesLastMonth={totalSwipesLastMonth}
319321
totalTimeSpent={totalSwipeTime}

0 commit comments

Comments
 (0)