graphql-loader icon indicating copy to clipboard operation
graphql-loader copied to clipboard

Option to automatically add ID field to queries

Open chrisdevereux opened this issue 7 years ago • 1 comments

In order for automatic cache updates to work correctly, Apollo (by default) requires that the id and __typename fields are provided in queries. It is very easy to forget to do this, often leading to subtle bugs that are annoying to track down.

Since this loader has access to the graphql schema, and therefore knows which types have a field of type ID, it could it be configured to auto-append the id field wherever it is needed in a query. This would be extremely helpful!

chrisdevereux avatar May 22 '18 14:05 chrisdevereux

Sounds like a nice option to add. A PR would be welcome! 😄

stephen avatar May 23 '18 03:05 stephen