Global onSuccess callback in the MutationCache , interferes with local onSuccess used in useMutation hooks. #7890
Unanswered
emekaokoli
asked this question in
Q&A
Replies: 1 comment
-
that shouldn't have any influence. please show a minimal reproduction |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there,
I've been using the global
mutationCache
for invalidating updates, and I've been relying on theonSuccess
status to navigate away from the page when it'strue
. However, I've noticed thatonSuccess
always returnsfalse
, even when the mutation is successful. When I commented out themutationCache
section, I found thatonSuccess
starts working as intended, returningtrue
orfalse
based on the mutation outcome.Now, I'm wondering if there's a way to use both the global invalidation and have
onSuccess
return the desired status of eithertrue
orfalse
.// where onSuccess is used.
Also, here's the version I am using:
"@tanstack/react-query": "^5.28.4",
Beta Was this translation helpful? Give feedback.
All reactions