question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEAT] Allow passing custom queryClient instance

See original GitHub issue

It’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:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
aliemircommented, Oct 7, 2022

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)

4reactions
jsbraincommented, Oct 7, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found