[FEAT] Allow passing custom queryClient instance
See original GitHub issueIt’s currently not possible to pass a queryClient to refine.
This make invalidating queries from outside react context really hard as this can currently only be done using the useInvalidate
hook.
Passing your own queryClient would allow sharing the queryClient instance with other parts of the application, even other frameworks.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
feat(trpc/next): allow passing complete QueryClient instead of ...
Describe the feature you'd like to request. When using createTRPCNext , we can pass in a queryClientConfig in the config-callback, for example:.
Read more >Sharing React Query across micro frontends with single-spa ...
The host app passes the same ReactQuery client to each micro front end using custom props so they can share the same cache....
Read more >Effective React Query Keys | TkDodo's blog
Learn how to structure React Query Keys effectively as your App grows.
Read more >QueryClient | TanStack Query Docs
getQueriesData is a synchronous function that can be used to get the cached data of multiple queries. Only queries that match the passed...
Read more >Mastering data fetching with React Query and Next.js
Learn how React Query simplifies data fetching and caching for you and how it works in tandem with the Next.js pre-rendering methods.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @jsbrain, it makes sense to have the option to pass
queryClient
and then you can have the necessary flexibility to access it from outside of React. We added this to our todo list and prioritized. We’re aiming to release it with the next minor version (probably today or tomorrow)@salihozdemir yes, that’s what I just said. I know the hook can be used to receive the query client. But it’s a react hook, which means it can only be used inside react.
There are times you’d want to access the queryClient outside of react.
I don’t think allowing to pass the client would be hard to achieve. It could still be merged with the existing options.