React Query v3 to v4 #7781
Unanswered
ashishjmeshram
asked this question in
Q&A
Replies: 1 comment 1 reply
-
hard to say, different batching probably. I'm not sure what you're trying to achieve with that code though. Are you aware that |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
We are trying to migrate from react. query v3 to react query v4.
Following same code is working differently in v3 and v4.
in v4 console output is like below
refresh called
MutateDemo.tsx:24 {data: Array(100), status: 200, statusText: '', headers: AxiosHeaders, config: {…}, …}
MutateDemo.tsx:25 setting data in refresh
MutateDemo.tsx:9 useEffect called
MutateDemo.tsx:10 isSuccess true
MutateDemo.tsx:11 data null
MutateDemo.tsx:15 in else - Resetting data
and in v3 console output is like below.
refresh called
MutateDemo.tsx:24 {data: Array(100), status: 200, statusText: '', headers: AxiosHeaders, config: {…}, …}
MutateDemo.tsx:25 setting data in refresh
MutateDemo.tsx:9 useEffect called
MutateDemo.tsx:10 isSuccess true
MutateDemo.tsx:11 data [object Object]
MutateDemo.tsx:13 in if
In v4, data is not getting set because of which in v4 flow does not go to if block. It always goes to else block.
If you see last two lines of output console. you will see the difference.
Why such behavior in v4?
https://codesandbox.io/p/sandbox/frosty-dan-wnfssc
Beta Was this translation helpful? Give feedback.
All reactions