-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Refetch returns undefined data and errors #2914
Comments
The network status seems to indicate that there were to obvious errors with the query execution. Could you implement a test case that elicits this behavior? That'll allow us to identify what is wrong and whether or not it constitutes intended behavior. |
We haven't heard back regarding the reproduction requested in #2914 (comment), so closing for now. If this issue is still happening, and you're able to supply a reproduction, we'll be happy to re-visit it. Thanks! |
Is there a reason why returnPartialData is true? This was hiding an error and returning { data: undefined, networkState: 7, stale: true } for me. I had forgotten to query for the id of an object and watchQuery could not find it in store. With returnPartialData false i was able to get an error about missing property and finally find the problem. With this true all i was getting from watchQuery was { data: undefined, networkState: 7, stale: true }. Maybe related issues: apollographql#3030 , apollographql#2914
I'm getting the exact same issue, the API hits successfully and returns data in network tab (chrom dev tools) but the promise returned by refetch has {data: undefined, errors: undefined, loading: false, networkStatus: 7, stale: false}. This happens when I pass variable (dynamic) in refetch as |
I found the issue, I had implemented cache in my apollo client, so whenever I was using refetch it used to get response from the cache. If variables were different it would return undefined. Setting up fetch policy to 'no-cache' in query options (I'm using hooks) resolved the issue |
I create the apollo client instance with the default settings set to no-cache, but I still had to explicitly set the fetchPolicy to no-cache in my queries to avoid this issue! |
Intended outcome:
I want to use
refetch
to re-send the same query with new variables. I expect the returned promise to deliver the results indata
.Actual outcome:
When
refetch
is used with new variables, the following object is returned by the promise:Version
The text was updated successfully, but these errors were encountered: