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

Change the cost of __typename #166

Open
emileber opened this issue Sep 11, 2019 · 2 comments
Open

Change the cost of __typename #166

emileber opened this issue Sep 11, 2019 · 2 comments

Comments

@emileber
Copy link

We'd need to adjust the cost of __typename for every type. Is there a quick way?

@taion
Copy link
Contributor

taion commented Sep 11, 2019

Hmm, I don't see a way to adjust the cost of __typename in the current API, actually. Do you have an idea for how this sort of API should look?

@emileber
Copy link
Author

Maybe generic getCost and getCostFactor in the options object, which receives the field name or type. Not sure what's best.

const ComplexityLimitRule = createComplexityLimitRule(1000, {
  scalarCost: 1,
  
  // Maybe something like this:
  getCost: (cost, field) => field === '__typename' ? MY_CUSTOM_COST : 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

2 participants