urql-graphql/urql

Syntax Error: Unexpected token in SelectionSet

gineika opened this issue · 1 comments

Describe the bug

import { gql } from 'urql'

gql`
  {
    user: getUser (id: 1) {
      id
    }
  }
`
GraphQLError: Syntax Error: Unexpected token at 23 in SelectionSet
      at new GraphQLError (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:7:5)
      at error (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:53:10)
      at selectionSet (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:404:13)
      at operationDefinition (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:522:21)
      at document (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:743:31)
      at parse (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:752:5)
      at keyDocument (/node_modules/.pnpm/@urql+core@5.0.0/node_modules/@urql/core/dist/urql-core-chunk.js:289:30)
      at gql (/node_modules/.pnpm/@urql+core@5.0.0/node_modules/@urql/core/dist/urql-core.js:263:18)
      at /test.mjs:3:1

Urql version

urql v4.0.7

Works with urql v4.0.6 AND @0no-co/graphql.web v1.0.4

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

Hiya 👋 Thanks for the prompt report!
As far as I can tell, this seems to be a small regression in graphql.web@1.0.5 with field arguments after an aliased field name not respecting ignored tokens.

This should be fixed with the hotfix I just published with @0no-co/graphql.web@1.0.6