From c3e220da31f831075bbe9e98beaaa0d036847c93 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Wed, 25 Sep 2024 16:02:16 +0300 Subject: [PATCH] don't even list a source value if there wasn't one, just like it's not in the map --- src/execution/values.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/execution/values.ts b/src/execution/values.ts index 2bc1b55117..cce0d1d12f 100644 --- a/src/execution/values.ts +++ b/src/execution/values.ts @@ -35,7 +35,7 @@ export interface VariableValues { interface VariableValueSource { readonly signature: GraphQLVariableSignature; - readonly value: unknown; + readonly value?: unknown; } type VariableValuesOrErrors = @@ -104,10 +104,7 @@ function coerceVariableValues( if (!Object.hasOwn(inputs, varName)) { const defaultValue = varSignature.defaultValue; if (defaultValue) { - sources[varName] = { - signature: varSignature, - value: undefined, - }; + sources[varName] = { signature: varSignature }; coerced[varName] = coerceDefaultValue(defaultValue, varType); } else if (isNonNullType(varType)) { const varTypeStr = inspect(varType); @@ -118,10 +115,7 @@ function coerceVariableValues( ), ); } else { - sources[varName] = { - signature: varSignature, - value: undefined, - }; + sources[varName] = { signature: varSignature }; } continue; } @@ -244,7 +238,9 @@ export function experimentalGetArgumentValues( if (valueNode.kind === Kind.VARIABLE) { const variableName = valueNode.name.value; - const scopedVariableValues = fragmentVariablesValues?.sources[variableName] + const scopedVariableValues = fragmentVariablesValues?.sources[ + variableName + ] ? fragmentVariablesValues : variableValues; if (