Questions tagged [react-apollo-hooks]
89 questions
0
votes
2 answers
How do I make Apollo Client tell me where in my code the error happened?
I'm learning React/Apollo and when I introduce bugs I get the typical red exceptions in my Chrome console. However, with Apollo, it doesn't tell me where in my code the error began as it does in React or other frameworks. When working with hooks…

Scott
- 3,204
- 3
- 31
- 41
0
votes
0 answers
How do I check existing JWT token validity during app load using Apollo Client?
If a user is returning to my site with existing JWT cookies I want to check if they are still valid. I think I want to preload my cache when the application loads by testing my auth token against the server.
Is this a good way/place to check if a…

Scott
- 3,204
- 3
- 31
- 41
0
votes
2 answers
Type 'DefaultClient' is not assignable to type 'ApolloClient
I am trying to explicitly supply a client to useMutation. Everything works fine except for the fact that typescript seems to see a type mismatch.
Type 'DefaultClient' is not assignable to type 'ApolloClient

David B.
- 788
- 1
- 11
- 21
0
votes
2 answers
How to get the mutation response?
I'm doing this mutation successfully in my reactjs app, but I want to get the response graphql returns but in my reactjs app, is it possible?
React code:
import { useMutation } from "@apollo/react-hooks";
const [addStoreToDB, { error }] =…

Lester Arévalo
- 342
- 1
- 6
- 12
0
votes
1 answer
Types for return values from Apollo client
This is a standard query made with react-apollo:
const { loading, data, error } = useQuery(
GET_ROCKET_INVENTORY,
{ variables: { year: 2019 } }
);
If I want pass loading, data or error to…

Fellow Stranger
- 32,129
- 35
- 168
- 232
0
votes
1 answer
bundling apollo useQuery hook with rollup
I'm trying to create a package that exports functionality using useQuery
However I get the following error:
Could not find "client" in the context or passed in as an option. Wrap the root component in an , or pass an ApolloClient…

Giles Bradshaw
- 1,249
- 2
- 9
- 8
0
votes
1 answer
React Hook error when calling the Apollo useQuery()
i am getting the below error while i am trying to use the useQuery(). Plese let me know if you need additional details..
Error: Invalid hook call. Hooks can only be called inside of the body
of a function component. This could happen for one of…

SRIKANTH DASARI
- 13
- 6
0
votes
0 answers
[GraphQL error]: Message: Cannot destructure property `id` of 'undefined' or 'null'., Location: [object Object], Path: newMessage
I'm new to React/Apollo hooks and I'm trying to practice with this concept to understand it better.
So I tried testing it with React-Native-Gifted-Chat and Apollo Client.
Query and Mutation work very well except for Subscription.
Image of the app…

Firman Jamal
- 113
- 2
- 12
0
votes
0 answers
Graphql subscription lost after few hours
I have made a subscription in aws appsync for sending notification to the react client. I am calling the subscription using lambda. It works fine but subscription stops after 2-3 hours and I need to then refresh the client application to make…

Mkaur
- 33
- 2
- 6
0
votes
1 answer
Apollo useQuery() - "refetch" is ignored if the response is the same
I am trying to use Apollo-client to pull my users info and stuck with this problem:
I have this Container component responsible for pulling the user's data (not authentication) once it is rendered. User may be logged in or not, the query returns…

SmxCde
- 5,053
- 7
- 25
- 45
0
votes
1 answer
Function executes before component is updated
You can find the CodeSandbox here
I am very new to react and I find it a bit confusing to put together my first application given the prevalence of different code styles in react.
The purpose of the application is to execute a GraphQL query with a…

lammy
- 457
- 2
- 5
- 22
-1
votes
1 answer
Apollo Client can't fetch data, because "Failed to parse source map from invariant.ts"
Apollo Client can't fetch data, because "Failed to parse source map from invariant.ts".I saw similar problem on forum, but it's outdated.
-1
votes
1 answer
Best Practice for realtime data fetching using reactJS and GraphQL
I am using react with graphQL and as a DB I use PostgreSQL.
so I have a list of records on my main screen and I want to change it when there's new record on my DB. my DB can be updated from different UI. so what's the best practice to update my FE…

Harsh Patel
- 6,334
- 10
- 40
- 73
-2
votes
2 answers
Using hooks with Apollo Provider
Here is a Codesandbox link recreating the issue:
https://codesandbox.io/s/boring-nash-svcj7?file=/src/index.js
I'm having a weird issue. I have a very simple setup Apollo setup just for testing purposes. It goes like this:
function App() {
return…

a53-416
- 3,585
- 6
- 34
- 44