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.

apollo-client not working as expected for `network-only` cache policy, duplicate requests noticed

See original GitHub issue

Intended outcome: Network tab doesn’t show duplicate query requests

Actual outcome:

Noticed the query being requested for twice How to reproduce the issue:

Versions System: OS: macOS High Sierra 10.13.6 Binaries: Node: 12.9.1 - /usr/local/bin/node npm: 6.10.3 - /usr/local/bin/npm Browsers: Chrome: 84.0.4143.2 Firefox: 75.0 Safari: 13.1 npmGlobalPackages: apollo: 3.0.0-beta.45

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

12reactions
easy-streetcommented, Oct 17, 2020

minimal reproduction here: codesandbox

Intended outcome: 1 request to /api/graphql when clicking the Fetch More button

Actual outcome: 2 requests to /api/graphql

How to reproduce the issue: click Fetch More & observe in devtools network tab

7reactions
bstrocommented, Feb 11, 2021

running into the same issue as @kfazinic — cache-first is the only option that will render the correct data. network-only and cache-and-network both first two requests… the first one has the correct offset, and the second is a stale offset. on apollo-client v3.3.9

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting The Correct Fetch Policy - Help - Apollo Community
I've noticed for example that upon requesting page 2 of live data, it this errors, I see page 1!! Just now I tried...
Read more >
Advanced topics on caching in Apollo Client
This article describes special cases and considerations when using the Apollo Client cache. Bypassing the cache. Sometimes you shouldn't use the cache for...
Read more >
Fetching data with queries | Full-Stack Quickstart
A fetch policy defines how Apollo Client uses the cache for a particular query. The default policy is cache-first , which means Apollo...
Read more >
Local state management - Apollo GraphQL Docs
Learn how to work with your local data in Apollo Client. ... Direct writes to the cache do not require a GraphQL mutation...
Read more >
Refetching queries in Apollo Client - Apollo GraphQL Docs
The InMemoryCache helps you determine which active queries might have been invalidated by recent cache updates. Local cache updates and refetching work ......
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