question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Network-only refetch after network error does not update networkStatus

See original GitHub issue

Versions

  • apollo-client@1.0.4
  • react-apollo@1.0.1

NOTE: this needs a seperate backend grpahql server to re-create so I have not created a react-apollo-error-template repo.

Intended outcome: Refetching a query after network error should always update loading to true and networkStatus to 4 - until either success or error happens.

Actual outcome: NetworkStatus remains at 8 and loading remains set to false on refetch. Only once server is up again and refetch completes susseccfully does networkStatus update to 7, and loading remains false the entire time.

How to reproduce the issue:

  • Create a simple component with a query and options of fetchPolicy: 'network-only', notifyOnNetworkStatusChange: true.
  • Have your component render a loading… text if loading is true.
  • Have your component render a refetch button<a onClick={() => refetch()>Try again</a> if error is true.
  • turn off your API server that has the graphql endpoint and load your component, it should render loading and then error states.
  • Click your refetch button a few times.
  • Turn back on your server.
  • Click refetch button again.
  • Note that networkStatus is staying on 8.

Related issues See https://github.com/apollographql/react-apollo/issues/642

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:38 (10 by maintainers)

github_iconTop GitHub Comments

23reactions
jer-sencommented, Oct 20, 2017

Hey! This is still an important and open issue!

14reactions
stale[bot]commented, Jul 29, 2017

This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Apollo Client!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refetching queries in Apollo Client - Apollo GraphQL Docs
To selectively refetch queries outside of a mutation, you instead use the refetchQueries method of ApolloClient , which is documented here. client.
Read more >
Apollo refetch does not make a request after network error
Within this app we would like to show the user a modal when there is no internet connection or when the API is...
Read more >
How to Query GraphQL - LogiCloud
This article shows how to fetch GraphQL data in React with the `useQuery` hook ... When loading is false and there is no...
Read more >
useQuery | Vue Apollo
notifyOnNetworkStatusChange : Whether or not updates to the network status should trigger next on the observer of this query. prefetch : (default: true...
Read more >
Strategies for service worker caching - Chrome Developers
A caching strategy is an interaction between a service worker's ... If not, fetch the image from the network, store the response in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found