File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -166,15 +166,21 @@ export function addFieldsWithOperator(
166166 operators = availableOperators ;
167167 }
168168 operators . forEach ( operatorName => {
169+ // unwrap from GraphQLNonNull and GraphQLList, if present
169170 const namedType = getNamedType ( existedFields [ fieldName ] . type ) ;
170171 if ( namedType ) {
171172 if ( operatorName . slice ( - 2 ) === '[]' ) {
172- fields [ operatorName . slice ( 0 , - 2 ) ] = {
173+ // wrap with GraphQLList, if operator required this with `[]`
174+ const newName = operatorName . slice ( 0 , - 2 ) ;
175+ fields [ newName ] = {
173176 ...existedFields [ fieldName ] ,
174177 type : new GraphQLList ( namedType ) ,
175178 } ;
176179 } else {
177- fields [ operatorName ] = namedType ;
180+ fields [ operatorName ] = {
181+ ...existedFields [ fieldName ] ,
182+ type : namedType ,
183+ } ;
178184 }
179185 }
180186 } ) ;
You can’t perform that action at this time.
0 commit comments