atulmy/gql-query-builder

Multiple query variables doesn't get set in the root query

Devorein opened this issue · 1 comments

PR#35 did solve the issue on nested fields, but unfortunately when using multiple operations the problem persists.

For example for the below query ...

const gqlquery = query([
  {
    operation: "getPublicationCount",
    variables: {
      round: true
    }
  },
  {
    operation: "getPublicationCount",
    variables: {
      ceil: true
    }
  }
]);

gqlquery.query is ...

query ($ceil: Boolean) { getPublicationCount (round: $round) { } getPublicationCount (ceil: $ceil) { } }

But it should be

query ($round: Boolean, $ceil: Boolean) { getPublicationCount (round: $round) getPublicationCount (ceil: $ceil) }

My PR solves the case with extraneous brackets but, it seems only the latest variables are set at the root query operation.

Sorry this issue was discussed at #16 .Closing it.