query gets replaced in the cache when calling the same query with different args
See original GitHub issueIntended outcome:
I want to refetch a query that has been called multiple times but with different variables after a mutation So basically, I have a page where I query a list of items with some variables. Then I go to a different page and now I use the same query but with different variables.
Actual outcome: When I go to the apollo devtools, I can see both queries there, but the first one gets replaced with the most recent one. So later on, when I use a mutation and I try to refetch the query by it’s name, it refetches only the most recent one
I can’t use the refetchQuery with the variables since at the moment I do the refetch, I don’t have the original arguments that the query was called
Versions
System:
OS: macOS 10.15.7
Binaries:
Node: 14.9.0 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
Browsers:
Chrome: 86.0.4240.183
Safari: 14.0
npmPackages:
@apollo/client: 3.2.5 => 3.2.5
@apollo/link-context: ^2.0.0-beta.3 => 2.0.0-beta.3
@apollo/link-error: ^2.0.0-beta.3 => 2.0.0-beta.3
apollo-upload-client: ^14.1.2 => 14.1.2
npmGlobalPackages:
apollo-codegen: 0.20.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Customizing the behavior of cached fields - Apollo GraphQL
In the query response, the field is populated with the read function's return ... The first parameter is the field's currently cached value...
Read more >How to handle Apollo cache updates for queries with multiple ...
I have a getTracks query that will fetch track data, and takes a handful of arguments for sorting/filtering (limit, offset, search, sort, order) ......
Read more >Redux Essentials, Part 8: RTK Query Advanced Patterns
So, RTK Query canceled the timer and kept using the same cached data ... into another file to keep the API slice file...
Read more >Customizing the behavior of cached fields - Client (React)
If you define a read function for a field, the cache calls that function whenever your client queries for the field. In the...
Read more >@urql/exchange-graphcache | urql Documentation
As a second argument the method accepts an updater function. This function will be called with the query data that is already in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
@tafelito any chance you can put together a small runnable reproduction that shows the issue?
@hwillson As far as I know, keyargs won’t help in this case