Skip to content

Expose QueryClient object in callbacks #5026

Answered by TkDodo
Jeday asked this question in Ideas
Discussion options

You must be logged in to vote

it's not easily possible to provide the queryClient to callbacks, because the client depends on usage, but a query / mutation is a separate entity. Theoretically, you can have the same query run under different providers with different clients. Yes, it would be two observers and the callbacks are on observer-level, so we could make that work, but I don't think we could pass the client to the cache level callbacks then, creating an incoherent api.

let's try to solve the problem from a different angle. If you want automatic invalidation without accessing the client, this can work:

https://twitter.com/TkDodo/status/1630321212013387776

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Jeday
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Jeday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants