Fix deleting a user shows User not found toast error (#41339)

This commit is contained in:
Joshen Lim authored and GitHub committed 2025-12-15 07:42:08 -07:00
1 parent 3dfb7ace25
commit 34b5e0bf07
2 files changed
+3 -3

No files matched your search

@@ -236,8 +236,8 @@ export const UsersV2 = () => {
const { setValue: setSelectedUser, value: selectedUser } = useQueryStateWithSelect({
urlKey: 'show',
enabled: users.length > 0 && isSuccess,
select: (id: string) => (id ? users?.find((u) => u.id === id)?.id : undefined),
enabled: !!users && !isLoading,
onError: () => toast.error(`User not found`),
})
@@ -36,13 +36,13 @@ export const useUserDeleteMutation = ({
async onSuccess(data, variables, context) {
const { projectRef, skipInvalidation = false } = variables
await onSuccess?.(data, variables, context)
if (!skipInvalidation) {
await Promise.all([
queryClient.invalidateQueries({ queryKey: authKeys.usersInfinite(projectRef) }),
])
}
await onSuccess?.(data, variables, context)
},
async onError(data, variables, context) {
if (onError === undefined) {