invalidateQueries or refetch is not working on delete and put request.
Delete functions work successfully and I get the toast.
the same method works with post request but not with put and delete. I am using the same query key to invalidate onSuccess.
4 Replies
deep-jadeOP•17mo ago
@Gludek
fascinating-indigo•16mo ago
The issue must be in your
handleDelete
function. If that promise resolves, then onSuccess
will be triggered.
With that knowledge, I think you should be able to do some more debugging and find the root cause.deep-jadeOP•16mo ago
onSuccess is working like i get the toast message and delete function also works but Invalidate and refetch not wowrking
and in this invalidate works
fascinating-indigo•16mo ago
One obvious difference is that you use
await
in your first sample, but not in the working sample.
I don't think it should make a difference, but try to change you non-working code step-by-step to be more similar to your working code, until you can figure out what is making the difference so it does not work.