parse the query variables correctly (#5273)

This commit is contained in:
James Gatz 2022-10-13 16:53:51 +02:00 committed by GitHub
parent 23b4ee60a6
commit 60bf0f9f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -509,12 +509,9 @@ export const GraphQLEditor: FC<Props> = ({
} catch (err) { } catch (err) {
body = { query: '' }; body = { query: '' };
} }
let maybeVariables;
if (typeof body.variables === 'string') {
maybeVariables = jsonParseOr(body.variables, '');
}
const query = body.query || ''; const query = body.query || '';
const variables = jsonPrettify(JSON.stringify(maybeVariables)); const variables = jsonPrettify(JSON.stringify(body.variables));
const variableTypes = buildVariableTypes(schema); const variableTypes = buildVariableTypes(schema);
// Create portal for GraphQL Explorer // Create portal for GraphQL Explorer