T
TanStack•2y ago
extended-salmon

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
extended-salmon
extended-salmonOP•2y ago
seems this is the case with all mutations btw
extended-salmon
extended-salmonOP•2y ago
No description
extended-salmon
extended-salmonOP•2y ago
tried 5.22.2, 5.20, 5.15, all not working
extended-salmon
extended-salmonOP•2y ago
hmm so pending is undefined but status is 'loading'? 👀 shouldnt that be 'pending'?
No description
noble-gold
noble-gold•2y ago
there is no status loading in v5

Did you find this page helpful?