-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache merge is producing extra network call #7034
Comments
Think I figured this one, the fix is to add empty keyfields to address cache: new InMemoryCache({
typePolicies: {
Address: {
keyFields: []
},
User: {
fields: {
address: {
merge: true
}
}
}
}
}) |
@dskelton-r7 Thanks for answering your own question! Since we're talking about an |
@benjamn Thanks for the response. That makes sense, so I updated the example with https://codesandbox.io/s/epic-stallman-jvw7q?file=/src/App.js |
@benjamn I also just noticed this issue that seems similar in nature #6307 Only 2 requests are being made here |
Let us know if this is still a concern with |
Intended 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/[email protected]
The text was updated successfully, but these errors were encountered: