T
TanStack•2y ago
rival-black

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);
}
});
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.
5 Replies
rival-black
rival-blackOP•2y ago
seems this is the case with all mutations btw
rival-black
rival-blackOP•2y ago
No description
rival-black
rival-blackOP•2y ago
tried 5.22.2, 5.20, 5.15, all not working
rival-black
rival-blackOP•2y ago
hmm so pending is undefined but status is 'loading'? 👀 shouldnt that be 'pending'?
No description
ratty-blush
ratty-blush•2y ago
there is no status loading in v5

Did you find this page helpful?