[GH-ISSUE #38] Multiple query variables doesn't get set in the root query #118

Closed
opened 2026-03-15 11:33:09 +03:00 by kerem · 1 comment
Owner

Originally created by @Devorein on GitHub (Jun 29, 2020).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/38

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.

Originally created by @Devorein on GitHub (Jun 29, 2020). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/38 [PR#35](https://github.com/atulmy/gql-query-builder/pull/35) did solve the issue on nested fields, but unfortunately when using multiple operations the problem persists. For example for the below query ... ```js 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](https://github.com/atulmy/gql-query-builder/pull/37) solves the case with extraneous brackets but, it seems only the latest variables are set at the root query operation.
kerem closed this issue 2026-03-15 11:33:14 +03:00
Author
Owner

@Devorein commented on GitHub (Jun 29, 2020):

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

<!-- gh-comment-id:651048666 --> @Devorein commented on GitHub (Jun 29, 2020): Sorry this issue was discussed at #16 .Closing it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#118
No description provided.