Skip to content

Commit

Permalink
Merge pull request #4476 from darrellwarde/chore/fix-query-printing
Browse files Browse the repository at this point in the history
Fix query printing in query logs
  • Loading branch information
darrellwarde authored Jan 4, 2024
2 parents d57503c + c02bd70 commit 2ba1fd8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/graphql/src/classes/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ export class Executor {
if (info) {
const source = {
// We avoid using print here, when possible, as it is a heavy process
query: info.operation.loc?.source.body || print(info.operation),
query:
info.operation.loc?.source.body ||
// Print both fragments and operation, otherwise printed queries are invalid due to missing fragments
[Object.values(info.fragments).map((fragment) => print(fragment)), print(info.operation)].join(
"\n\n"
),
params: info.variableValues,
};

Expand Down

0 comments on commit 2ba1fd8

Please sign in to comment.