@@ -54,14 +54,14 @@ export function fragmentArgumentSubstitutions(
5454  } 
5555
5656  for  ( const  variableDefinition  of  variableDefinitions )  { 
57-     const  argumentName  =  variableDefinition . variable . name . value ; 
58-     if  ( substitutions . has ( argumentName ) )  { 
57+     const  variableName  =  variableDefinition . variable . name . value ; 
58+     if  ( substitutions . has ( variableName ) )  { 
5959      continue ; 
6060    } 
6161
6262    const  defaultValue  =  variableDefinition . defaultValue ; 
6363    if  ( defaultValue )  { 
64-       substitutions . set ( argumentName ,  defaultValue ) ; 
64+       substitutions . set ( variableName ,  defaultValue ) ; 
6565    }  else  { 
6666      // We need a way to allow unset arguments without accidentally 
6767      // replacing an unset fragment argument with an operation 
@@ -72,9 +72,11 @@ export function fragmentArgumentSubstitutions(
7272      //    - make unset fragment arguments invalid 
7373      // Requiring the spread to pass all non-default-defined arguments is nice, 
7474      // but makes field argument default values impossible to use. 
75-       substitutions . set ( argumentName ,  { 
75+       substitutions . set ( variableName ,  { 
7676        kind : Kind . VARIABLE , 
77-         name : {  kind : Kind . NAME ,  value : '__UNSET'  } , 
77+         // We set the variable name to something that is "guaranteed" to be unset 
78+         // so that we can leverage default field arguments when defined. 
79+         name : {  kind : Kind . NAME ,  value : variableName  +  '__UNSET'  } , 
7880      } ) ; 
7981    } 
8082  } 
0 commit comments