Reputation: 5671
I am curious if I have to always include the id
field when making queries to a relay graph QL server?
For example:
users_connection {
edges {
node {
id
userId
firstName
}
}
}
I sometime use the id
field as a component key when looping on results, but generally speaking I don't use it. Does relay use this under the hood on the client to perform caching?
I have tested removing this from my queries and haven't notice a difference to my app.
Upvotes: 1
Views: 637
Reputation: 5230
relay-compiler adds it automatically to any type that has an id
field even if it hasn't been explicitly requested. But you still need to add it if you actually use it in your own code.
Upvotes: 4