You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The meta and mutationKey on previous mutations get updated when state in a component is updated.
This only happens the first time the state updates and only on the last mutation in the cache.
See the website list the mutation: "0 = 0 = 0 is true" ([value] = [key] = [meta] is [equal])
Click the button "Bump state"
See the website list the mutation: "0 = 1 = 1 is false"
Expected behavior
I expect that all existing mutations should not be altered when some state updates.
Meaning step 4. should stay "0 = 0 = 0 is true".
Meaning that the mutation key and meta object should still hold the value 0 that was the value when the mutation happened.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows
Browser: Edge
Version: 119.0.2151.58
Tanstack Query adapter
react-query
TanStack Query version
5.18.1
TypeScript version
No response
Additional context
You can also see the values being updated in the ReactQueryDevtools.
The text was updated successfully, but these errors were encountered:
I see it is fixed when the key is updated. But I would also assume meta should not be updated on old mutations. This is actually happening when a key is missing or the same.
See the website list the mutation: "0 = 0 is true" ([value] = [meta] is [equal])
Click the button "Bump state"
Click the button "Bump state"
See the website list the mutation: "0 = 2 is false"
Expected behavior
I expect that all existing mutations should not be altered when some state updates.
Meaning step 5. should stay "0 = 0 is true".
Meaning that the meta object should still hold the value 0 that was the value when the mutation happened.
Does my reasoning and what I expect sound like what should happen, @TkDodo? Also not that meta is only updated every second time, bug is not triggered on odd number of "Bump state" clicks.
the currently observed mutation will get updates, I think that's expected. Otherwise, we would run into stale closure issues, like the one we fixed here:
Describe the bug
The
meta
andmutationKey
on previous mutations get updated when state in a component is updated.This only happens the first time the state updates and only on the last mutation in the cache.
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-pchfwb?file=src%2FApp.tsx
Steps to reproduce
Expected behavior
I expect that all existing mutations should not be altered when some state updates.
Meaning step 4. should stay "0 = 0 = 0 is true".
Meaning that the mutation key and meta object should still hold the value
0
that was the value when the mutation happened.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
5.18.1
TypeScript version
No response
Additional context
You can also see the values being updated in the ReactQueryDevtools.
The text was updated successfully, but these errors were encountered: