frontend-rw #1

Merged
marcin merged 347 commits from frontend-rw into develop 2024-12-05 15:32:18 -08:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit c11ed8a6ac - Show all commits

View file

@ -1,9 +1,11 @@
import { useMutation, type InfiniteData } from '@tanstack/react-query';
import { makePaginatedResponseQuery } from 'pl-fe/queries/utils/make-paginated-response-query';
import { minifyAccountList } from 'pl-fe/queries/utils/minify-list';
import { useClient } from 'pl-fe/hooks/use-client';
import { queryClient } from 'pl-fe/queries/client';
import { makePaginatedResponseQuery } from 'pl-fe/queries/utils/make-paginated-response-query';
import { minifyAccountList } from 'pl-fe/queries/utils/minify-list';
import { removeGroupMember } from './use-group-members';
const appendGroupBlock = (groupId: string, accountId: string) =>
queryClient.setQueryData<InfiniteData<ReturnType<typeof minifyAccountList>>>(['accountsLists', 'groupBlocks', groupId], (data) => {
@ -32,7 +34,10 @@ const useBlockGroupUserMutation = (groupId: string, accountId: string) => {
return useMutation({
mutationKey: ['accountsLists', 'groupBlocks', groupId, accountId],
mutationFn: () => client.experimental.groups.blockGroupUsers(groupId, [accountId]),
onSettled: () => appendGroupBlock(groupId, accountId),
onSettled: () => {
removeGroupMember(groupId, accountId);
appendGroupBlock(groupId, accountId);
},
});
};

View file

@ -42,4 +42,4 @@ const useKickGroupMemberMutation = (groupId: string, accountId: string) => {
type MinifiedGroupMember = ReturnType<typeof minifyGroupMembersList>['items'][0];
export { useGroupMembers, useKickGroupMemberMutation, type MinifiedGroupMember };
export { useGroupMembers, useKickGroupMemberMutation, removeGroupMember, type MinifiedGroupMember };