-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expose queryClient
in QueryFunctionContext
#3151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Should consider #2548 which adds the ability to nest QueryClient contexts. |
I've decided to not move along with this for now. The use-case is pretty narrow, and the custom context complicates that a bit more. There also doesn't seem to be an incredible need for this features. |
I would be interested in having this feature. Is the reason why this is not considered the fact that it is too much work or is it that this functionality is not wanted? If it's the first then I might be able to look into it. What are the things to consider that could make the implementation difficult? |
you can use the same query from within multiple providers, but there is only one Query instance. Only observers have access to the QueryClient, the query itself (which also runs the queryFn) does not. |
Originally posted by @TkDodo in #2764 (comment)
This issue is a follow-up of the discussion above.
The idea is to have access to the queryClient in the queryFn, using QueryFunctionContext to simplify usage when the queryFn is defined outside of a
useQuery/fetchQuery
call.The text was updated successfully, but these errors were encountered: