Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
104 views

Create a helper function to call react-query mutation

I am using graphql-codegen with react-query to generate mutations like these. const [createLogMutation, {}] = useCreateLogMutation({ variables: { data: { logType, message, task ...
Bishal Heuju's user avatar
0 votes
0 answers
89 views

Unexpected error object with mock-service-worker and react-query with graphql

I'm writing a test where I expect an error message to show. This is the component I'm testing: export const CourseOverview = () => { const { data, isError, error, isSuccess } = useGetCourses(); ...
publicJorn's user avatar
  • 2,464
0 votes
1 answer
828 views

React-Query Causing un-necessary re-renders

I am trying to fetch data using graphql-request and react query. It causes re-renders. How erver if i comment out the part the re-renders stops. const { data, error, isLoading } = useGQLQuery('...
Vishal Regmi's user avatar
1 vote
0 answers
270 views

How to use @tanstack/vue-query with graphql codegen in ts? Because there is no typescript-vue-query plugin similar to typescript-react-query for vue

Please suggest if possible in some way. I have tried to change the import path from react-query to vue-query after typescript-react-query has done with it. But I didn't able to make it work (actually ...
Aditya Yaduvanshi's user avatar
10 votes
1 answer
22k views

Query data cannot be undefined. Please make sure to return a value other than undefined from your query function

I'm sending a request to a graphql endpoint using a useQuery hook, I work with react.js and next.js. This request is to show a list of projects on my website. When I check the network tab in the ...
Laura Díaz's user avatar
1 vote
2 answers
2k views

how to use `useQueries` hook (@tanstack/react-query) with graphql-codegen?

I've been using graphql-codegen for several month, it's a great tool. I've always used it with @tanstack/react-query useQuery & useMutation hooks. Today, I would like to use it with useQueries (...
LIIT's user avatar
  • 576
5 votes
2 answers
9k views

React Query useMutation - "No overload matches this call"

I'm using react-query in a typescript project, and am getting a hard to interpret type error when trying to use the useMutation() hook with a graphql query. Example Code: useMutation( async ( ...
James Brunskill's user avatar
0 votes
1 answer
103 views

rect-query: Pass additional key for navigation

I am trying to pass a key for navigation, which specifies to show the query/page after the current query call. useform.ts ... ... export const useupdateSurveyForm = () => { const queryClient = ...
user15361826's user avatar
0 votes
0 answers
787 views

React: How to solve graphql/ react query error "Parse error on.."

Here I am trying to get QRcode details by calling graphql query : showQrCode. The code is as follows. get id using useParams(). Then called useQrCode() ... const params = useParams(); const { data } = ...
user15361826's user avatar
2 votes
1 answer
1k views

typescript can't resolve typing from graphql query that returns a union type

I would like to understand what is going on here, and since i'm not very experienced with typescript, any help would be greatly appreciated ! I've got a resolver to return one cost from database : @...
LIIT's user avatar
  • 576
0 votes
1 answer
747 views

How to catch GraphQL request errors status via react-query `useQuery`

I want to implement a retry on failed queries. I'm using react-query's QueryClient to handle queries with GraphQL. I can't find any good example online on how to handle GraphQL query errors via react-...
SeyAde's user avatar
  • 35
0 votes
1 answer
1k views

React Query SSR prefetchQuery not firing request

I'm trying to fetch some data from SpaceX's GraphQL API. I'm using Next, React Query, and GraphQL Code Generator. Once everything is generated the SSR implementation using queryClient.prefetchQuery ...
wsfuller's user avatar
  • 1,840
7 votes
2 answers
14k views

GraphQL Code Generator - Failed to load schema from http://localhost:8000/graphql - Request with GET/HEAD method cannot have body

I've built a GraphQL API using strawberry and strawberry-django-plus that is hosted on http://localhost:8000/graphql using Django. I am able to successfully interact with the API using GraphiQL on ...
sebtheiler's user avatar
  • 2,407
1 vote
1 answer
280 views

Is it possible to mock schema fields in GaphQL request in react-query like apolloclient does it?

I am working on migrating my app to react-query from apolloclient. With apolloclient, I am mocking the schema like it's shown here. Here's what that looks like: const users = [ { name: "...
Alberto Vilches's user avatar
1 vote
0 answers
470 views

Removing React Query Batch mode

React query seems to batch my requests before they go out. They do not fire to server independently. As well they return at the same time. perhaps under the hook it does a Promise.all(). Any thoughts? ...
Ed Diaz's user avatar
  • 97

15 30 50 per page