Merge branch 'invalidate-members' into 'develop'

GroupMembershipRequests: invalidate list on unmount

See merge request soapbox-pub/soapbox!2418
This commit is contained in:
Alex Gleason 2023-04-04 21:32:11 +00:00
commit 9e5bd27cfb
2 changed files with 12 additions and 3 deletions

View file

@ -1,12 +1,13 @@
import React from 'react';
import React, { useEffect } from 'react';
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
import Account from 'soapbox/components/account';
import { AuthorizeRejectButtons } from 'soapbox/components/authorize-reject-buttons';
import ScrollableList from 'soapbox/components/scrollable-list';
import { Column, HStack, Spinner } from 'soapbox/components/ui';
import { useGroup } from 'soapbox/hooks/api';
import { useGroupMembershipRequests } from 'soapbox/hooks/api/groups/useGroupMembershipRequests';
import { useGroup, useGroupMembershipRequests } from 'soapbox/hooks/api';
import { useGroupMembers } from 'soapbox/hooks/api/useGroupMembers';
import { GroupRoles } from 'soapbox/schemas/group-member';
import toast from 'soapbox/toast';
import ColumnForbidden from '../ui/components/column-forbidden';
@ -59,6 +60,13 @@ const GroupMembershipRequests: React.FC<IGroupMembershipRequests> = ({ params })
const { group } = useGroup(id);
const { accounts, authorize, reject, isLoading } = useGroupMembershipRequests(id);
const { invalidate } = useGroupMembers(id, GroupRoles.USER);
useEffect(() => {
return () => {
invalidate();
};
}, []);
if (!group || !group.relationship || isLoading) {
return (

View file

@ -12,6 +12,7 @@ export { useCreateGroup, type CreateGroupParams } from './groups/useCreateGroup'
export { useDeleteGroup } from './groups/useDeleteGroup';
export { useDemoteGroupMember } from './groups/useDemoteGroupMember';
export { useGroup, useGroups } from './groups/useGroups';
export { useGroupMembershipRequests } from './groups/useGroupMembershipRequests';
export { useGroupSearch } from './groups/useGroupSearch';
export { useGroupValidation } from './groups/useGroupValidation';
export { useJoinGroup } from './groups/useJoinGroup';