Replies: 4 comments 8 replies
-
An idea I had on why this could be happening possibly. Let's say I have two components that both run the same useQuery query: Even if I have stale time set to 0, is it possible that the queries in these components could be affecting each other and causing the mismatch error with the server? |
Beta Was this translation helpful? Give feedback.
-
Please show a runnable reproduction, e.g. codesandbox. You're not even showing react-query code - potentially lives in |
Beta Was this translation helpful? Give feedback.
-
any soluction or work around 🙌🙌 |
Beta Was this translation helpful? Give feedback.
-
I found a work using one of the recommended ways just add a since
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am getting the following error:
Here is a CodeSandbox reproducing the issue.
There are two queries in order to demonstrate the error happening when components mount and shared queries starting/finishing at different times:
When console logging
postsQuery.status
in theBeersAndPosts
component, I see that the error occurs during this scenario:loading
success
.Hence, why there seems to be a mismatch.
The error seems to happen when the status on the client starts off immediately as
success
(seemingly skipping theloading
status on first render). Which is why it's mismatched with what the server renders. My guess is that this mismatch error happens when different components mount at different times, shared queries start and finish at different times, and hence what's rendered on the client ends up being different from what the server rendered.Any ideas why this could be happening or something I'm doing wrong? Any help would be greatly appreciated as it's been driving me a bit insane. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions