diff --git a/packages/client-react-streaming/src/DataTransportAbstraction/printMinified.tsx b/packages/client-react-streaming/src/DataTransportAbstraction/printMinified.tsx index fd1147dc..bbcb9e77 100644 --- a/packages/client-react-streaming/src/DataTransportAbstraction/printMinified.tsx +++ b/packages/client-react-streaming/src/DataTransportAbstraction/printMinified.tsx @@ -1,15 +1,7 @@ import type { DocumentNode } from "@apollo/client/index.js"; import { print } from "@apollo/client/utilities/index.js"; +import { stripIgnoredCharacters } from "graphql"; export function printMinified(query: DocumentNode): string { - return ( - print(query) - // replace multi-spaces with single space - .replace(/\s{2,}/g, " ") - // remove spaces that are preceeded by braces - .replace(/(?<=[{}])\s+/g, "") - // remove spaces that are preceeding braces - .replace(/\s+(?=[{}])/g, "") - .trim() - ); + return stripIgnoredCharacters(print(query)); }