Skip to content
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

Repeated selections for distinct field names are dropped during merge #87

Closed
gmac opened this issue Nov 3, 2021 · 1 comment · Fixed by #104
Closed

Repeated selections for distinct field names are dropped during merge #87

gmac opened this issue Nov 3, 2021 · 1 comment · Fixed by #104
Labels
bug Something isn't working

Comments

@gmac
Copy link
Contributor

gmac commented Nov 3, 2021

Low-priority edge case: when making a query selection with multiple selections on a distinct field, data is only returned for the first selection...

query {
  shop1 {
    products {
      name
    }
    products {
      manufacturer {
        name
      }
    }
  }
}

This query only returns data for the first field selection, while technically it should return a union of the two:

{
  "data": {
    "shop1": {
      "products": [
        {
          "name": "iPhone"
        },
        {
          "name": "Apple Watch"
        }
      ]
    }
  }
}

The query plan looks about like I'd expect, and my remote servers are executing the appropriate steps:

{
    "RootSteps": [{
        "ServiceURL": "http://localhost:4003/graphql",
        "ParentType": "Query",
        "SelectionSet": "{ shop1 { _id: id products { _id: id } products { _id: id } } }",
        "InsertionPoint": null,
        "Then": [{
            "ServiceURL": "http://localhost:4002/graphql",
            "ParentType": "Product",
            "SelectionSet": "{ _id: id name }",
            "InsertionPoint": ["shop1", "products"],
            "Then": null
        }, {
            "ServiceURL": "http://localhost:4002/graphql",
            "ParentType": "Product",
            "SelectionSet": "{ _id: id manufacturer { _id: id } }",
            "InsertionPoint": ["shop1", "products"],
            "Then": [{
                "ServiceURL": "http://localhost:4001/graphql",
                "ParentType": "Manufacturer",
                "SelectionSet": "{ _id: id name }",
                "InsertionPoint": ["shop1", "products", "manufacturer"],
                "Then": null
            }]
        }]
    }]
}

Therefore, I'd venture to guess that the loss of data happens in the post-request assembly process. Logging this here as a backlog item.

@nmaquet nmaquet added the bug Something isn't working label Nov 3, 2021
@nmaquet
Copy link
Contributor

nmaquet commented Nov 3, 2021

Thanks for reporting this! We'll look into it in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants