Only one field is not updating in Supabase DB Table while I'm using react-query mutation #4046
Unanswered
itsmohsinali5
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there! I have reminder schedule in which user have to select time on which email must be scheduled. I have used react-query mutation functions for creating and updating reminder schedules.
.
Issue:
I'm adding some code you can see that:
const creator = useCreateReminderScheduleMutation({
onSuccess: async (data) => {
queryClient.invalidateQueries("GetReminderSchedule");
console.log("data", data);
if (data.createReminderSchedule.enabled) {
await schedulePushNotification(data.createReminderSchedule);
} else {
await cancelNotification(data.createReminderSchedule.id);
}
},
onError: (error) => {
console.log({ error });
alertActions.addAlert({
title:
Error: ${error}
,type: "error",
repeat: false,
});
},
});
And these are the fields which I'm creating and updating:
const createMutation = (field: { [key: string]: any }) => {
console.log({
input: {
scheduledFor: "12:00:00.000Z",
...field,
userId,
type: reminderName,
},
});
creator.mutate({
input: {
scheduledFor: "12:00:00.000Z",
...field,
userId,
type: reminderName,
},
});
};
Even I'm seeing in log it is updating but still getting data undefined in onSuccess :(
Anyone can help please?
Beta Was this translation helpful? Give feedback.
All reactions