You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One issue I've seen come up multiple times is Apollo's caching mechanism throwing when a given __typename has at some point been queried with id (which Apollo uses to normalize the cache), but subsequent queries (maybe upon specific types of client-side routing/navigation) omit the id for the same type.
This causes Apollo to throw an exception, treating the query as a failure even though data came back successfully. For example:
queryGetMovies {
movies {
idname
}
}
Then, clicking something or navigating somewhere leads to this query:
queryGetMovieNames {
movies {
name
}
}
This would throw an error not because the data couldn't be retrieved but because the cache doesn't know how to handle it.
eslint-plugin-graphql has a unique opportunity to catch these types of issues pretty easily. Thoughts on adding a validation rule to prevent this?
The outcome would be if you have any documents that include the id field for a given __typename, you could warn/error if any other documents have omitted the id field.
The text was updated successfully, but these errors were encountered:
One issue I've seen come up multiple times is Apollo's caching mechanism throwing when a given
__typename
has at some point been queried withid
(which Apollo uses to normalize the cache), but subsequent queries (maybe upon specific types of client-side routing/navigation) omit theid
for the same type.This causes Apollo to throw an exception, treating the query as a failure even though data came back successfully. For example:
Then, clicking something or navigating somewhere leads to this query:
This would throw an error not because the data couldn't be retrieved but because the cache doesn't know how to handle it.
eslint-plugin-graphql
has a unique opportunity to catch these types of issues pretty easily. Thoughts on adding a validation rule to prevent this?The outcome would be if you have any documents that include the
id
field for a given__typename
, you could warn/error if any other documents have omitted theid
field.The text was updated successfully, but these errors were encountered: