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.

Stale data on variables change with no-cache fetch policy

See original GitHub issue

Branching off from #6039 so the issue doesn’t get lost.

Intended outcome:

The data returned from useQuery should be undefined when the variables change even when using fetchPolicy: 'no-cache'.

Actual outcome:

The data remains stale regardless of #6566.

How to reproduce the issue:

I’ve tweaked the reproduction provided in #6039 - please click here.

Versions

I’m currently using v3.1.2 (see below) but the same issue happens in the latest 3.2.0-beta6.

  System:
    OS: Windows 10 10.0.19041
  Binaries:
    Node: 14.4.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 84.0.4147.135
    Edge: Spartan (44.19041.423.0), Chromium (84.0.522.63)
  npmPackages:
    @apollo/client: 3.1.2 => 3.1.2
    apollo-link-rest: 0.8.0-beta.0 => 0.8.0-beta.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hwillsoncommented, May 29, 2021

Most (if not all?) of our stale data issues started waaaaaay back, when we decided to merge https://github.com/apollographql/react-apollo/pull/1639. This has been a monstrous source of problems over the years, and is an area we definitely need to get right as we work on our React integration layer rewrite.

1reaction
sdankelcommented, May 20, 2021

Yes, it repros in 3.3.19.

Updated @delyanr 's repro with 3.3.19 and a working GraphQL endpoint here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced topics on caching in Apollo Client
In this example, we use client. onResetStore to write default values to the cache. This is useful when using Apollo Client's local state...
Read more >
Understanding Apollo Fetch Policies | by Galen Corey - Medium
Understanding fetch policies can be extremely helpful in thinking about data flow possibilities with the Apollo Client.
Read more >
Query Cache - MariaDB Knowledge Base
Each time changes are made to the data in a table, all affected results in the query cache are cleared. It is not...
Read more >
Advanced Topics on Caching – Angular
Using update gives you full control over the cache, allowing you to make changes to your data model in response to a mutation...
Read more >
Caching in GitLab CI/CD
Runners use cache to speed up the execution of your jobs by reusing existing data. This can sometimes lead to inconsistent behavior. There...
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