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
{{ message }}
This repository has been archived by the owner on May 19, 2023. It is now read-only.
The way we hydrate the
react-query
cache on the client is a bit convoluted and unnecessarily complex DX.I think I could make mine a bit easier to deal with so it's more generic instead:
queryClient
fromreact-query
& populate it's cache when calling stuffqueryClientData={hydrate(queryClient}}
to the Client componentqueryClientData
& usessetQueryData
API on the server (here) could look something like:
Not that nice with HOC
Or, if the HOC was a render-prop thing, maybe this could work:
Then, the client could "just work" in a pre-hydrated way where we wouldn't need to pass
initialData
.Overview of how to do it
/@trpc
new QueryClient()
and populate it as we're calling (similar to ourutils.*.fetch()
queryClient
isn't used across multiple clients' requests.The text was updated successfully, but these errors were encountered: