graphql-code-generator-community
graphql-code-generator-community copied to clipboard
(react-query) Adding both a hook version of exposing fetcher and passing in the query context
Is your feature request related to a problem? Please describe.
Two problems
- We should be able to expose a fetcher for the query function even when using a hook
- We should pass in the query context so that we can access signal: Abort especially as that will be the only way to cancel queries it in react-query 4 and it will allow access to meta which should solve passing data to the fetcher. https://react-query.tanstack.com/guides/query-cancellation
Describe the solution you'd like
The fetcher is easy a hook that returns the function simples The context would be using the same way infinite query works and pass a context down to the fetcher
Describe alternatives you've considered
Both of these are currently not available
Additional context
Hi there, I am currently working with graphql, codegen and react-query in a project and we noticed that we can't properly use queryClient.cancelQueries as signal is not passed to our custom fetcher especially for infinite queries.
I looked around the repo issues and found that this PR is closed although it should contain the fix to my problem aka not being able to pass the AbortSignal object to our HTTP client.
Is there any chance it will be fixed/merged ?