From 7329c0bf258ae92eda6742efba3a50ec13e16c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 19 Mar 2023 20:32:53 +0100 Subject: [PATCH] Do not make requests to api/v1/groups if fffeature not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/hooks/useGroups.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/soapbox/hooks/useGroups.ts b/app/soapbox/hooks/useGroups.ts index 865896e24f..96f73dbe1c 100644 --- a/app/soapbox/hooks/useGroups.ts +++ b/app/soapbox/hooks/useGroups.ts @@ -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( [Entities.GROUPS, ''], '/api/v1/groups', - { schema: groupSchema }, + { enabled: features.groups, schema: groupSchema }, ); const { relationships } = useGroupRelationships(entities.map(entity => entity.id));