-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relay creates invalid query with union type where one type implements Node
#1203
Comments
Weird. We should only be generating an |
@josephsavona Turns out in this instance That still shouldn’t be correct though right? |
The fact that |
You should check your schema.json for the definition of the
I suspect your union type |
What @NevilleS said :-) |
Here’s what the introspection query result is. Names and descriptions are obfuscated of course. {
"kind": "UNION",
"name": "B",
"description": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": [
{
"kind": "OBJECT",
"name": "C",
"ofType": null
},
{
"kind": "OBJECT",
"name": "D",
"ofType": null
},
{
"kind": "OBJECT",
"name": "E",
"ofType": null
}
]
} |
Hm. Alright, I'd recommend you add a snippet like this to
|
Closing this as it refers to classic where we don't expect to do any major updates, please re-open if this still applies to the modern compiler. |
Relay is generating an
id
field on a union type where all types in the union type do not implementNode
. Here’s a schema (with names obfuscated):With a query that looks like:
Relay generates an id field so the query that gets sent looks more like:
This of course fails on the server.
Edit: In the original post, I omit that
A
implementedNode
.A implements Node
was therefore retrospectively added. See this comment.The text was updated successfully, but these errors were encountered: