-
Hi All, So I am looking for a way to invalidate the response from a mutation, similar to how a query can be invalidated using Here is the situation: We use state returned by the mutation to display UI elements. For example: the However, I would like automatically reset this state with a 5 second delay, so that the icon doesn't remain in the UI. Is there a way to invalidate this directly in the const {
mutate: updateSettings,
isPending: mutatePending,
isSuccess, // The isSuccess state is used in the UI to show a checkmark in the action button.
} = useMutation({
mutationKey: ["updateOrganizationSettings"],
mutationFn: updateOrganizationSettings,
...onErrorToast(),
onSuccess: () => {
toast.success("Settings updated successfully"),
queryClient.invalidateQueries({
queryKey: ["getOrganizationById"],
});
},
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
call |
Beta Was this translation helpful? Give feedback.
call
reset
returned fromuseMutation