From f2c65ff6646f0e65d4267047916fca033e804d8a Mon Sep 17 00:00:00 2001 From: Ian Hunter Date: Mon, 31 Jan 2022 09:27:18 -0600 Subject: [PATCH] fix bug where some requests pass variables = {} instead of variables = undefined --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 0e4d11f7..46bec60d 100644 --- a/index.js +++ b/index.js @@ -536,8 +536,10 @@ const plugin = fp(async function (app, opts) { } const shouldCompileJit = cached && cached.count++ === minJit + const shouldValidateVariables = variables !== undefined && Object.keys(variables).length > 0 + // Validate variables - if (variables !== undefined && !shouldCompileJit) { + if (shouldValidateVariables && !shouldCompileJit) { const executionContext = buildExecutionContext({ schema: fastifyGraphQl.schema, document,