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.

Misleading documentation with regards to `query`'s `fetchPolicy` allowed policies

See original GitHub issue

Intended outcome: Set “cache-and-network” when querying directly from the ApolloClient.

Actual outcome: Error message:

Error: cache-and-network fetchPolicy can only be used with watchQuery

How to reproduce the issue: Follow the documentation here and try to query via client.query(...) with fetch policy "cache-and-network".

Version

  • apollo-client@<version number>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:47
  • Comments:34 (12 by maintainers)

github_iconTop GitHub Comments

16reactions
cyberdudecommented, Dec 13, 2018

Is this still a thing?

8reactions
theodorDiaconucommented, Aug 31, 2018

Any update on this ? This is very strange! I expected the query to return initially from cache and make the request in the meantime then the component will get updated with fresh data!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Queries - Apollo GraphQL Docs
This article assumes you're familiar with building basic GraphQL queries. ... This cache-first policy is Apollo Client's default fetch policy.
Read more >
Advanced Topics on Caching – Angular
This can be done using the no-cache fetchPolicy . The no-cache policy does not write to the cache with the response.
Read more >
Policy API - Okta Developer
The Policy framework is used by Okta to control Rules and settings that govern, among other things, user session lifetime, whether multi-factor authentication ......
Read more >
React Apollo: Understanding Fetch Policy with useQuery
Otherwise, Apollo Client executes the query against your GraphQL server and returns that data after caching it. Prioritizes minimizing the ...
Read more >
How to implement GraphQL with Flutter + GraphQL example
The queries.dart file contains a queries string document (more on this ... Due to GraphQL's flexibility in regard to retrieving specific ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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