TanStackT
TanStack2y ago
5 replies
endless-jade

useMutation's `isPending` stays on `undefined` after calling mutate

so I have a custom useMutation hook
return useMutation({
        mutationFn: api.Profiles.acceptFriendRequestInNotification,
        onSuccess: async (_data, { requestId, notificationId, metadata }) => {
                        console.log('IS SUCCESS'); <- this is logged
            ...
        },
        onError: () => {
            errorSnackbar(MUTATE_ERROR);
        }
    });

but whenever this gets called the
isPending
always stays on
undefined
for some reason, even tho the mutation does get executed.
Was this page helpful?