fetchPolicy no-cache not working
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
The fetchPolicy 'no-cache'is supposed to disable the default behavior for GraphQL queries to take the cached response of the query and thus save on network requests. I always wanted this behavior but never got it working in my app. Now I have set up a fresh project just for demo and it is not working here either.
To Reproduce
Steps to reproduce the behavior:
Try to send the same graphql query two or more times and notice it will only send one network request.
I have setup a demo project for this: https://github.com/mg98/apollo-cache-not-working
I created it with the Vue CLI and vue add apollo with pre setup configuration. Follow the readme to start the app. There will be a text explaining you how to test the behavior.
Expected behavior
Always send a network request, because I globally set fetchPolicy to 'no-cache'.
Versions
vue: 2.6.11
vue-apollo: 3.0.0.beta.11, I can also verify for 3.0.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction project's README and follow its steps to run the Vue CLI demo. Trace how vue-apollo 3.0.x applies the global fetchPolicy setting, then repeat the same GraphQL query and verify that no-cache produces a network request each time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100