Connections inside of union fragments are not converted from arrays
See original GitHub issueIt seems any Relay connection inside a fragment in a union or interface is ignored by the arrToConnection function since this function ignores typedChildren in the SQL AST.
Example query:
{
files {
edges {
node {
id
name
path
... on Folder {
contents {
edges {
node {
id
name
path
}
}
}
}
}
}
}
}
Expected output:
{
"data": {
"files": {
"edges": [
{
"node": {
"id": "Rm9sZGVyOjE=",
"name": "a folder",
"path": "/",
"contents ": {
"edges": [
{
"node": {
"id": "Rm9sZGVyOjI=",
"name": "another folder",
"path": "/a folder/"
}
}
]
}
}
}
]
}
}
}
Actual output:
{
"data": {
"files": {
"edges": [
{
"node": {
"id": "Rm9sZGVyOjE=",
"name": "a folder",
"path": "/",
"contents ": {
"edges": null
}
}
}
]
}
}
}
Using debugging mode I can see that the data is retrieved correctly and initially stored as an array but the sqlAST contains the SQLASTNode information in sqlAST.typedChildren.Folder[] rather than sqlAST.children and so it never processes the array into connection format and the response edges is null instead of an array of nodes.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Fragments - Apollo GraphQL Docs
Using fragments with unions and interfaces You can define fragments on unions and interfaces. The all_characters query above returns a list of Character ......
Read more >Union of arrays doesn't get converted to array of unions #35294
Actual behavior: Conversion of union of arrays to array of unions happens only if it's enforced manually, and only if there is no...
Read more >How to map graphql query which is using union and ...
I'm using union in schema and fragments in query to get what i need and then render it on page. From what i...
Read more >Data Type (GLSL) - OpenGL Wiki - Khronos Group
Signed integers can be implicitly converted to unsigned integers, but the reverse is not true. Either integer type can be converted into floats,...
Read more >Common Problems Found in RAML 1.0 API Specifications
Common misconceptions about examples and RAML NamedExample fragments ... References to inner elements are valid only for XSD and JSON schemas.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hugobarreiro Thanks for tackling the unit test part of this fix. I haven’t been able to spend more time on this lately.
You can definitely contribute these! Please do in fact