From 57b74a5d09eea66df25b78383c44feb83a80ae87 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Fri, 2 Sep 2022 18:12:55 -0600 Subject: [PATCH] Use cached values --- web/pages/groups.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/web/pages/groups.tsx b/web/pages/groups.tsx index 76c859c3..92a813aa 100644 --- a/web/pages/groups.tsx +++ b/web/pages/groups.tsx @@ -7,12 +7,7 @@ import { Col } from 'web/components/layout/col' import { Row } from 'web/components/layout/row' import { Page } from 'web/components/page' import { Title } from 'web/components/title' -import { - useGroupContractIds, - useGroups, - useMemberGroupIds, - useMemberIds, -} from 'web/hooks/use-group' +import { useGroups, useMemberGroupIds } from 'web/hooks/use-group' import { useUser } from 'web/hooks/use-user' import { groupPath, listAllGroups } from 'web/lib/firebase/groups' import { getUser, User } from 'web/lib/firebase/users' @@ -180,7 +175,7 @@ export default function Groups(props: { export function GroupCard(props: { group: Group; creator: User | undefined }) { const { group, creator } = props - const groupContracts = useGroupContractIds(group.id) + const { totalContracts } = group return ( @@ -198,7 +193,7 @@ export function GroupCard(props: { group: Group; creator: User | undefined }) { {group.name} - {groupContracts.length} questions + {totalContracts} questions @@ -214,11 +209,11 @@ export function GroupCard(props: { group: Group; creator: User | undefined }) { function GroupMembersList(props: { group: Group }) { const { group } = props - const memberIds = useMemberIds(group.id) - if (memberIds.length === 1) return
+ const { totalMembers } = group + if (totalMembers === 1) return
return (
- {memberIds.length} members + {totalMembers} members
) }