File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -158,9 +158,9 @@ function parseObjectFields(
158158 const weight = isCompositeType ( listType )
159159 ? typeWeightObject [ listType . name . toLowerCase ( ) ] . weight
160160 : typeWeights . scalar ; // Note this includes enums
161+ let multiplier = 1 ;
161162 if ( limitArg ) {
162163 const node : ValueNode = limitArg . value ;
163- let multiplier = 1 ;
164164 if ( Kind . INT === node . kind ) {
165165 multiplier = Number ( node . value || arg . defaultValue ) ;
166166 }
@@ -169,16 +169,13 @@ function parseObjectFields(
169169 variables [ node . name . value ] || arg . defaultValue
170170 ) ;
171171 }
172- return multiplier * ( selectionsCost + weight ) ;
173172 // ? what else can get through here
174- }
175-
176- // if there is no argument provided with the query, check the schema for a default
177- if ( arg . defaultValue ) {
178- return Number ( arg . defaultValue ) * ( selectionsCost + weight ) ;
173+ } else if ( arg . defaultValue ) {
174+ // if there is no argument provided with the query, check the schema for a default
175+ multiplier = Number ( arg . defaultValue ) ;
179176 }
180177 // if there is no argument or default value, return 0 complexity
181- return 1 ;
178+ return multiplier * ( selectionsCost + weight ) ;
182179 } ,
183180 } ;
184181 }
You can’t perform that action at this time.
0 commit comments