[GH-ISSUE #87] Subscriptions nested fields/operations #54

Open
opened 2026-03-03 00:03:00 +03:00 by kerem · 0 comments
Owner

Originally created by @tsukeero on GitHub (Oct 10, 2023).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/87

Using the same query with nested operation on subscription throws an error (works with normal query):

fields: [
                "id",
                {
                    operation: "some_aggregate",
                    fields: [{aggregate: ["count"]}],
                    variables: {
                      varname: {
                        name:"where",
                        type:'some_aggregate_bool_exp!',
                        value: {
                            visible: { _eq: true },
                        }
                      },
                    },
                },
            ],

Uppon quick look at the source it looks they use a different implementation of queryFieldsMap.

The DefaultQueryAdapter.ts is using Utils.queryFieldsMap(this.fields)
While the DefaultSubscriptionAdapter is using this.queryFieldsMap(this.fields)](https://github.com/atulmy/gql-query-builder/blob/master/src/adapters/DefaultSubscriptionAdapter.ts#L94C6-L94C40) (which is different and doesn't seem to have nested fields handled correct).

Would the fix be a simple replacement to call the one from utils or is something else I am missing?

Originally created by @tsukeero on GitHub (Oct 10, 2023). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/87 Using the same query with nested operation on subscription throws an error (works with normal query): ```js fields: [ "id", { operation: "some_aggregate", fields: [{aggregate: ["count"]}], variables: { varname: { name:"where", type:'some_aggregate_bool_exp!', value: { visible: { _eq: true }, } }, }, }, ], ``` Uppon quick look at the source it looks they use a different implementation of `queryFieldsMap`. The `DefaultQueryAdapter.ts` is using `Utils.queryFieldsMap(this.fields)` While the `DefaultSubscriptionAdapter` is using `this.queryFieldsMap(this.fields)`](https://github.com/atulmy/gql-query-builder/blob/master/src/adapters/DefaultSubscriptionAdapter.ts#L94C6-L94C40) (which is different and doesn't seem to have nested fields handled correct). Would the fix be a simple replacement to call the one from utils or is something else I am missing?
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#54
No description provided.