nhost/nhost-dart

Nhost gql link uses websocketlink incorrectly for queries that appear in a document that also has subscriptions

Opened this issue · 0 comments

Nhost's gql link implementation incorrectly uses a websocket link for a query operation if it appears in a document that also has a subscription due to this logic.

E.g. if you have a file like items.gql:

query getItem {
...
}

subscription subscribeItem(
...
}

In this case, nhost will incorrectly consider the getItem query to be a subscription and try to use a websocket link.

This can hopefully be fixed by using the extension available in newer versions of gql_exec (getOperationType is available in 1.0.0 and newer but nhost_dart is pinned on a lot of older gql packages.

Note that graphql-flutter's implementation only considers the correct operation name and discards the other operations.