Network-only refetch after network error does not update networkStatus
See original GitHub issueVersions
- 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:
- Created 6 years ago
- Reactions:11
- Comments:38 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! This is still an important and open issue!
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!