I'm using GraphQL with Apollo Client in my react project. The issue is when I'm fetching data of elements with the field id,
For example: the schema
Person {
id
name
}
In case the id is nullable and has an empty value, the result is an array of Person objects but with the same Person.
Is id a special field in Apollo client cache implementation?
Yes it is, you can specify in your frontend a specific cache id if you need too, but this field should be unique.
Custom Cache ID https://www.apollographql.com/docs/react/caching/cache-configuration/#customizing-cache-ids
If you field is not unique, and you don't have a id, you can create a fake id from other fields of this ressource in a type resolver, like a hash with the name, and a other field
Hope my anwser help you :)