-
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
ID returned but apollo not merging cache results for nested objects #7187
Comments
@JasonMan34 Thanks for the reproduction! Here's how you tell new InMemoryCache({
typePolicies: {
City: {
keyFields: ["cityId"],
},
},
}) |
Is there any way to tell apollo to assume a singular keyField using the field with type |
There's nothing about the |
Unfortunately that won't work for us. Either way, thank you for the help and clarifications! |
Intended outcome:
Have the cache merge nested objects when an ID is returned
Actual outcome:
The cache result is overwritten by the latest query even though an ID is returned
How to reproduce the issue:
Repro: https://codesandbox.io/s/unruffled-faraday-uq8ch
On the first render both
PEOPLE_1
andPEOPLE_2
queries will be called, and oncePEOPLE_2
gets a response the console will show this warning message:However, all objects of type City have IDs.
Changing the
cityId
field's name toid
resolves this issue, but that's not an option for me since our database isn't build like thatVersions
System:
OS: Windows 10 10.0.18362
Binaries:
Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 86.0.4240.75
Edge: Spartan (44.18362.449.0)
npmPackages:
@apollo/client: ^3.2.0 => 3.2.0
apollo-link-error: ^1.1.13 => 1.1.13
The text was updated successfully, but these errors were encountered: