-
Notifications
You must be signed in to change notification settings - Fork 41
Labels
Description
The cost complexity cost-limit
plugin does not take into account how many entities are being returned when either the first
or last
argument are specified at the field level.
These two examples which have the same complexity cost (I have omitted edges
and pageInfo
to keep these examples simple)
query simpleQuery {
books {
title
author
}
}
query connectionQuery {
books(first: 1) {
title
author
}
}
The cost complexity of this query should increase by a factor of the number of books requested
query connectionQuery {
books(first: 3) {
title
author
}
}
I have a PR that modifies the computeComplexity
function in packages/plugins/cost-limit/src/index.ts/
to factor this in to the complexity cost algorithm.
Note the PR does not currently handle VariableDefinitions
but will handle the example above