Skip to content

Custom GraphQLScalarType instance: parseLiteral is called twice #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
royalcala opened this issue Feb 4, 2019 · 2 comments
Closed

Custom GraphQLScalarType instance: parseLiteral is called twice #1713

royalcala opened this issue Feb 4, 2019 · 2 comments

Comments

@royalcala
Copy link

The parseLiteral method is called twice

const express_graphql = require('express-graphql')
var { buildSchema } = require('graphql')

var OddType = new GraphQLScalarType({
  name: 'Odd',
  parseLiteral(ast) {
   console. log('this print twice before continue with the resolver')
    return null
}
}
@IvanGoncharov
Copy link
Member

@createcsoft Thanks for taking the time to report this issue 👍
It was already reported as #383 so I'm closing this as a duplicate.

@applegrew
Copy link

I have faced this issue, but the issue in my case is with Mercurius. It first runs buildContext which evaluates the variables, then it fires execute which again fires buildContext which in-turn again executes the variables. (ref: https://github.com/mercurius-js/mercurius/blob/master/index.js#L507)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants