All Questions
Tagged with react-query graphql
29
questions
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
...
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();
...
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('...
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 ...
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 ...
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 (...
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 (
...
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 = ...
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 } = ...
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 :
@...
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-...
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 ...
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 ...
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: "...
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?
...