File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -589,10 +589,7 @@ function resolveField(
589
589
fieldNodes: $ReadOnlyArray< FieldNode > ,
590
590
path: Path,
591
591
): PromiseOrValue< mixed > {
592
- const fieldNode = fieldNodes [ 0 ] ;
593
- const fieldName = fieldNode . name . value ;
594
-
595
- const fieldDef = getFieldDef ( exeContext . schema , parentType , fieldName ) ;
592
+ const fieldDef = getFieldDef ( exeContext . schema , parentType , fieldNodes [ 0 ] ) ;
596
593
if ( ! fieldDef ) {
597
594
return;
598
595
}
@@ -1171,8 +1168,10 @@ export const defaultFieldResolver: GraphQLFieldResolver<
1171
1168
export function getFieldDef (
1172
1169
schema : GraphQLSchema ,
1173
1170
parentType : GraphQLObjectType ,
1174
- fieldName : string ,
1171
+ fieldNode : FieldNode ,
1175
1172
) : ?GraphQLField < mixed , mixed > {
1173
+ const fieldName = fieldNode . name . value ;
1174
+
1176
1175
if (
1177
1176
fieldName === SchemaMetaFieldDef . name &&
1178
1177
schema . getQueryType ( ) === parentType
Original file line number Diff line number Diff line change @@ -199,10 +199,10 @@ async function executeSubscription(
199
199
new Set ( ) ,
200
200
) ;
201
201
const [ responseName , fieldNodes ] = [ ...fields . entries ( ) ] [ 0 ] ;
202
- const fieldName = fieldNodes [ 0 ] . name . value ;
203
- const fieldDef = getFieldDef ( schema , type , fieldName ) ;
202
+ const fieldDef = getFieldDef ( schema , type , fieldNodes [ 0 ] ) ;
204
203
205
204
if ( ! fieldDef ) {
205
+ const fieldName = fieldNodes [ 0 ] . name . value ;
206
206
throw new GraphQLError (
207
207
`The subscription field "${ fieldName } " is not defined.` ,
208
208
fieldNodes ,
You can’t perform that action at this time.
0 commit comments