Cache merge is producing extra network call
See original GitHub issueIntended outcome:
Given two components, Component A and Component B that run the same query, with Component B requesting a little more from the graph.
When defining a custom merge function and using network-only on both components useQuery
calls.
There should only be 2 network requests made. 1 for Component A and 1 for B.
Actual outcome: The request for Component A is made again after component B finishes.
How to reproduce the issue: Using apollo client v3.2.0 https://codesandbox.io/s/awesome-gagarin-4rdyp?file=/src/App.js
Not happening using apollo client v2 https://codesandbox.io/s/nice-goodall-odfcy?file=/src/App.js
Versions @apollo/client@3.2.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Customizing the behavior of cached fields - Apollo GraphQL
The merge function. If you define a merge function for a field, the cache calls that function whenever the field is about to...
Read more >Apollo GraphQL merge cached data - Stack Overflow
On the first request, I set Movie data in the cache, on the second request to the same query I just replace old...
Read more >Customizing the behavior of cached fields - Client (React)
If you define a merge function for a field, the cache calls that function whenever the field is about to be written with...
Read more >Caching in GitLab CI/CD
A cache is one or more files a job downloads and saves. Subsequent jobs that use the same cache ... However, the first...
Read more >Merge geometry caches - Maya - Autodesk Knowledge Network
If the caches you want to merge aren't overlapping, but have gaps between them, then the gaps are linearly interpolated and no cache...
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
@benjamn I also just noticed this issue that seems similar in nature https://github.com/apollographql/apollo-client/issues/6307 So I downgraded to
@apollo/client@3.0.0-beta.45
and its not longer happening. Here is a reproduction of that.Only 2 requests are being made here https://codesandbox.io/s/infallible-gagarin-u32cz?file=/src/App.js
Let us know if this is still a concern with
@apollo/client@latest
- thanks!