Replies: 1 comment
-
you need to create the query client per request on the server |
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.
-
Not sure if this is a bug or maybe intentional, but just wanted to share something that I have noticed. In one project where we are using Tanstack Start, Router, and Query, we sometimes use this pattern for data fetching:
https://tanstack.com/router/latest/docs/framework/react/guide/router-context#how-about-an-external-data-fetching-library
and the server function looks something like this:
What we noticed, is that this queryClient is caching something on the server, because if you, for example, have two different users, and one user fetches this data, another user will get that other users data from the cache.
Maybe this is just a documentation thing, but to me it was not clear that following this kind of approach would cache some stuff on the server, I assumed it would be cached to the users browser, like how Tanstack Query usually works.
Beta Was this translation helpful? Give feedback.
All reactions