From cb4477185cc368197d15802432deb1470ff0baa7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 26 Jun 2023 11:25:03 -0500 Subject: [PATCH] Update usages of useGroupRelationships hook --- app/soapbox/api/hooks/groups/useGroupSearch.ts | 5 ++++- app/soapbox/api/hooks/groups/useGroups.ts | 5 ++++- app/soapbox/api/hooks/groups/useGroupsFromTag.ts | 5 ++++- app/soapbox/api/hooks/groups/usePopularGroups.ts | 2 +- app/soapbox/api/hooks/groups/useSuggestedGroups.ts | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/soapbox/api/hooks/groups/useGroupSearch.ts b/app/soapbox/api/hooks/groups/useGroupSearch.ts index d1d8acf9c..295d63933 100644 --- a/app/soapbox/api/hooks/groups/useGroupSearch.ts +++ b/app/soapbox/api/hooks/groups/useGroupSearch.ts @@ -21,7 +21,10 @@ function useGroupSearch(search: string) { { enabled: features.groupsDiscovery && !!search, schema: groupSchema }, ); - const { relationships } = useGroupRelationships(entities.map(entity => entity.id)); + const { relationships } = useGroupRelationships( + ['discover', 'search', search], + entities.map(entity => entity.id), + ); const groups = entities.map((group) => ({ ...group, diff --git a/app/soapbox/api/hooks/groups/useGroups.ts b/app/soapbox/api/hooks/groups/useGroups.ts index 13ca45713..f5450bd73 100644 --- a/app/soapbox/api/hooks/groups/useGroups.ts +++ b/app/soapbox/api/hooks/groups/useGroups.ts @@ -15,7 +15,10 @@ function useGroups(q: string = '') { () => api.get('/api/v1/groups', { params: { q } }), { enabled: features.groups, schema: groupSchema }, ); - const { relationships } = useGroupRelationships(entities.map(entity => entity.id)); + const { relationships } = useGroupRelationships( + ['search', q], + entities.map(entity => entity.id), + ); const groups = entities.map((group) => ({ ...group, diff --git a/app/soapbox/api/hooks/groups/useGroupsFromTag.ts b/app/soapbox/api/hooks/groups/useGroupsFromTag.ts index 2c7e5a94f..6c2b88bb1 100644 --- a/app/soapbox/api/hooks/groups/useGroupsFromTag.ts +++ b/app/soapbox/api/hooks/groups/useGroupsFromTag.ts @@ -19,7 +19,10 @@ function useGroupsFromTag(tagId: string) { enabled: features.groupsDiscovery, }, ); - const { relationships } = useGroupRelationships(entities.map(entity => entity.id)); + const { relationships } = useGroupRelationships( + ['tags', tagId], + entities.map(entity => entity.id), + ); const groups = entities.map((group) => ({ ...group, diff --git a/app/soapbox/api/hooks/groups/usePopularGroups.ts b/app/soapbox/api/hooks/groups/usePopularGroups.ts index b5959a335..69b04e32f 100644 --- a/app/soapbox/api/hooks/groups/usePopularGroups.ts +++ b/app/soapbox/api/hooks/groups/usePopularGroups.ts @@ -20,7 +20,7 @@ function usePopularGroups() { }, ); - const { relationships } = useGroupRelationships(entities.map(entity => entity.id)); + const { relationships } = useGroupRelationships(['popular'], entities.map(entity => entity.id)); const groups = entities.map((group) => ({ ...group, diff --git a/app/soapbox/api/hooks/groups/useSuggestedGroups.ts b/app/soapbox/api/hooks/groups/useSuggestedGroups.ts index be9b5a78e..69fb71065 100644 --- a/app/soapbox/api/hooks/groups/useSuggestedGroups.ts +++ b/app/soapbox/api/hooks/groups/useSuggestedGroups.ts @@ -18,7 +18,7 @@ function useSuggestedGroups() { }, ); - const { relationships } = useGroupRelationships(entities.map(entity => entity.id)); + const { relationships } = useGroupRelationships(['suggested'], entities.map(entity => entity.id)); const groups = entities.map((group) => ({ ...group,