We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the onSuccess handler for useMutation fires, you will have stale values of the state used inside onSuccess.
onSuccess
useMutation
My thinking is that useMutation probably uses the value of onSuccess when mutate() is ran.
mutate()
https://codesandbox.io/s/focused-buck-fxbe50?file=/src/App.tsx:966-1008
As a user, I expected isOpen to be false. Instead, I got true -- which was the value of isOpen when the mutation ran.
isOpen
false
true
Every time
v3.39.3
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
When the
onSuccess
handler foruseMutation
fires, you will have stale values of the state used insideonSuccess
.My thinking is that
useMutation
probably uses the value ofonSuccess
whenmutate()
is ran.Your minimal, reproducible example
https://codesandbox.io/s/focused-buck-fxbe50?file=/src/App.tsx:966-1008
Steps to reproduce
Expected behavior
As a user, I expected
isOpen
to befalse
. Instead, I gottrue
-- which was the value ofisOpen
when the mutation ran.How often does this bug happen?
Every time
Screenshots or Videos
Platform
TanStack Query version
v3.39.3
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: