From 3d1c0fa81351ff1a3cf31ff837384c47cb3594c6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 4 Apr 2023 11:16:26 -0500 Subject: [PATCH] Fix groups index being updated when a new group is created --- app/soapbox/entity-store/utils.ts | 2 +- app/soapbox/hooks/api/groups/useCreateGroup.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/soapbox/entity-store/utils.ts b/app/soapbox/entity-store/utils.ts index e108639c2d..3f65f1ee0c 100644 --- a/app/soapbox/entity-store/utils.ts +++ b/app/soapbox/entity-store/utils.ts @@ -11,7 +11,7 @@ const updateStore = (store: EntityStore, entities: Entity[]): EntityStore => { /** Update the list with new entity IDs. */ const updateList = (list: EntityList, entities: Entity[]): EntityList => { const newIds = entities.map(entity => entity.id); - const ids = new Set([...Array.from(list.ids), ...newIds]); + const ids = new Set([...newIds, ...Array.from(list.ids)]); if (typeof list.state.totalCount === 'number') { const sizeDiff = ids.size - list.ids.size; diff --git a/app/soapbox/hooks/api/groups/useCreateGroup.ts b/app/soapbox/hooks/api/groups/useCreateGroup.ts index e2c54971c2..302374946b 100644 --- a/app/soapbox/hooks/api/groups/useCreateGroup.ts +++ b/app/soapbox/hooks/api/groups/useCreateGroup.ts @@ -16,7 +16,7 @@ interface CreateGroupParams { function useCreateGroup() { const api = useApi(); - const { createEntity, ...rest } = useCreateEntity([Entities.GROUPS], (params: CreateGroupParams) => { + const { createEntity, ...rest } = useCreateEntity([Entities.GROUPS, 'search', ''], (params: CreateGroupParams) => { return api.post('/api/v1/groups', params, { headers: { 'Content-Type': 'multipart/form-data',