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
Consider this union type union SearchResult = Human | Droid | Starship.
And this query:
{
search(text: "an") {
__typename
... on Human {
id
name
height
}
... on Droid {
id
name
primaryFunction
}
... on Starship {
id
name
length
}
}
}
This query handles all possible conditional fragments of a SearchResult.
Now, consider the following query:
{
search(text: "an") {
__typename
... on Human {
id
name
height
}
... on Droid {
id
name
primaryFunction
}
}
}
This query is missing the conditional fragment for the Starship type.
If you try to run this query using Apollo, you can sometimes run into this error: Store error: the application attempted to write an object with no provided id but the store already contains an id of <Starship_id_here> for this object. The selectionSet that was trying to be written is:
This error is silent in Apollo, so it's hard to tell when it happens and some digging needs to happen.
Instead, it would be nice if eslint-plugin-graphql enforced all conditional fragments of a Union type to be handled.
The text was updated successfully, but these errors were encountered:
Consider this union type
union SearchResult = Human | Droid | Starship
.And this query:
This query handles all possible conditional fragments of a
SearchResult
.Now, consider the following query:
This query is missing the conditional fragment for the
Starship
type.If you try to run this query using Apollo, you can sometimes run into this error:
Store error: the application attempted to write an object with no provided id but the store already contains an id of <Starship_id_here> for this object. The selectionSet that was trying to be written is:
This error is silent in Apollo, so it's hard to tell when it happens and some digging needs to happen.
Instead, it would be nice if eslint-plugin-graphql enforced all conditional fragments of a Union type to be handled.
The text was updated successfully, but these errors were encountered: