Skip to content
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

Multiple query/mutation and onComplete behavior #25

Open
PierrickP opened this issue Apr 25, 2019 · 0 comments
Open

Multiple query/mutation and onComplete behavior #25

PierrickP opened this issue Apr 25, 2019 · 0 comments

Comments

@PierrickP
Copy link

I don't know if it is a bug or not

For this test case

test('should consider default cost with operationName', done => {
  const ast = parse(
    `
    query operationA {
      defaultCost
    }

    query operationB {
      defaultCost
    }
  `)

  const context = new ValidationContext(schema, ast, typeInfo)
  const visitor = new CostAnalysis(context, {
    maximumCost: 100,
    defaultCost: 12,
    onComplete: cost => {
      console.log('cost', cost)
      done()
    }
  })

  visit(ast, visitWithTypeInfo(typeInfo, visitor))
})

I have 2 queries, onComplete will be called 2 times
First time, cost is 12, second time 24. 🤔

After that, i use operationName, like "operationName":"operationB"
Should operationA be analysed and count in the total cost ?

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

1 participant