@@ -38,7 +38,10 @@ import {
3838 validateInputValue ,
3939} from '../utilities/validateInputValue.ts' ;
4040
41- import type { FragmentVariableValues } from './collectFields.ts' ;
41+ import type {
42+ FragmentVariableValues ,
43+ FragmentVariableValueSource ,
44+ } from './collectFields.ts' ;
4245import type { GraphQLVariableSignature } from './getVariableSignature.ts' ;
4346import { getVariableSignature } from './getVariableSignature.ts' ;
4447
@@ -306,17 +309,23 @@ export function getFragmentVariableValues(
306309) : FragmentVariableValues {
307310 const argumentNodes = fragmentSpreadNode . arguments ?? [ ] ;
308311 const argNodeMap = new Map ( argumentNodes . map ( ( arg ) => [ arg . name . value , arg ] ) ) ;
309- const sources = Object . create ( null ) ;
310- const coerced = Object . create ( null ) ;
312+ const sources : ObjMap < FragmentVariableValueSource > = Object . create ( null ) ;
313+ const coerced : ObjMap < unknown > = Object . create ( null ) ;
311314 for ( const [ varName , varSignature ] of Object . entries ( fragmentSignatures ) ) {
312- sources [ varName ] = {
313- signature : varSignature ,
314- } ;
315315 const argumentNode = argNodeMap . get ( varName ) ;
316316 if ( argumentNode !== undefined ) {
317- const source = sources [ varName ] ;
318- source . value = argumentNode . value ;
319- source . fragmentVariableValues = fragmentVariableValues ;
317+ sources [ varName ] =
318+ fragmentVariableValues == null
319+ ? { signature : varSignature , value : argumentNode . value }
320+ : {
321+ signature : varSignature ,
322+ value : argumentNode . value ,
323+ fragmentVariableValues,
324+ } ;
325+ } else {
326+ sources [ varName ] = {
327+ signature : varSignature ,
328+ } ;
320329 }
321330
322331 coerceArgument (
0 commit comments