diff --git a/app/soapbox/api/hooks/accounts/useRelationships.ts b/app/soapbox/api/hooks/accounts/useRelationships.ts index f145a8a5cb..49a03f5eba 100644 --- a/app/soapbox/api/hooks/accounts/useRelationships.ts +++ b/app/soapbox/api/hooks/accounts/useRelationships.ts @@ -7,12 +7,16 @@ import { type Relationship, relationshipSchema } from 'soapbox/schemas'; function useRelationships(listKey: string[], ids: string[]) { const api = useApi(); const { isLoggedIn } = useLoggedIn(); - const q = ids.map(id => `id[]=${id}`).join('&'); + + function fetchRelationships(ids: string[]) { + const q = ids.map((id) => `id[]=${id}`).join('&'); + return api.get(`/api/v1/accounts/relationships?${q}`); + } const { entityMap: relationships, ...result } = useBatchedEntities( [Entities.RELATIONSHIPS, ...listKey], ids, - () => api.get(`/api/v1/accounts/relationships?${q}`), + fetchRelationships, { schema: relationshipSchema, enabled: isLoggedIn }, );