Merge branch 'use-groups-condition' into 'develop'

Do not make requests to api/v1/groups if feature not available

See merge request soapbox-pub/soapbox!2363
develop^2
marcin mikołajczak 2023-03-20 21:57:35 +00:00
commit 282afaa47f
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -5,11 +5,15 @@ import { useEntities, useEntity } from 'soapbox/entity-store/hooks';
import { groupSchema, Group } from 'soapbox/schemas/group';
import { groupRelationshipSchema, GroupRelationship } from 'soapbox/schemas/group-relationship';
import { useFeatures } from './useFeatures';
function useGroups() {
const features = useFeatures();
const { entities, ...result } = useEntities<Group>(
[Entities.GROUPS, ''],
'/api/v1/groups',
{ schema: groupSchema },
{ enabled: features.groups, schema: groupSchema },
);
const { relationships } = useGroupRelationships(entities.map(entity => entity.id));