Fix groups index being updated when a new group is created

This commit is contained in:
Alex Gleason 2023-04-04 11:16:26 -05:00
parent 8d67556bdf
commit 3d1c0fa813
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 2 additions and 2 deletions

View file

@ -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;

View file

@ -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',