File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -1515,6 +1515,20 @@ describe('Execute: Handles inputs', () => {
15151515 } ) ;
15161516 } ) ;
15171517
1518+ it ( 'when argument passed to a directive on a nested field' , ( ) => {
1519+ const result = executeQueryWithFragmentArguments ( `
1520+ query {
1521+ ...a(value: true)
1522+ }
1523+ fragment a($value: Boolean!) on TestType {
1524+ nested { echo(input: "echo") @skip(if: $value) }
1525+ }
1526+ ` ) ;
1527+ expect ( result ) . to . deep . equal ( {
1528+ data : { nested : { } } ,
1529+ } ) ;
1530+ } ) ;
1531+
15181532 /* TODO: add back when @defer and @stream are supported
15191533 it('when a nullable argument to a directive with a field default is not provided and shadowed by an operation variable', () => {
15201534 // this test uses the @defer directive and incremental delivery because the `if` argument for skip/include have no field defaults
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ interface CollectFieldsContext {
4646 schema : GraphQLSchema ;
4747 fragments : ObjMap < FragmentDetails > ;
4848 variableValues : { [ variable : string ] : unknown } ;
49- fragmentVariableValues ?: FragmentVariables ;
5049 runtimeType : GraphQLObjectType ;
5150 visitedFragmentNames : Set < string > ;
5251}
@@ -107,9 +106,15 @@ export function collectSubfields(
107106 const subGroupedFieldSet = new AccumulatorMap < string , FieldDetails > ( ) ;
108107
109108 for ( const fieldDetail of fieldGroup ) {
110- const node = fieldDetail . node ;
111- if ( node . selectionSet ) {
112- collectFieldsImpl ( context , node . selectionSet , subGroupedFieldSet ) ;
109+ const selectionSet = fieldDetail . node . selectionSet ;
110+ if ( selectionSet ) {
111+ const { fragmentVariables } = fieldDetail ;
112+ collectFieldsImpl (
113+ context ,
114+ selectionSet ,
115+ subGroupedFieldSet ,
116+ fragmentVariables ,
117+ ) ;
113118 }
114119 }
115120
You can’t perform that action at this time.
0 commit comments