From 71c92d57191fa04fcd46557edf9eb0646a4e1675 Mon Sep 17 00:00:00 2001 From: Liam Schuitemaker <75234271+schweetheart@users.noreply.github.com> Date: Fri, 1 Dec 2023 07:08:14 -0600 Subject: [PATCH] Updates Client Preset Persisted Documents documentation with hashAlgorithm options (#9760) --- .../pages/plugins/presets/preset-client.mdx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/website/src/pages/plugins/presets/preset-client.mdx b/website/src/pages/plugins/presets/preset-client.mdx index 3bd98db7a11..18417bf4a7d 100644 --- a/website/src/pages/plugins/presets/preset-client.mdx +++ b/website/src/pages/plugins/presets/preset-client.mdx @@ -491,6 +491,29 @@ console.log(response.status) console.log(await response.json()) ``` +### Hashing algorithm + +To override the default hash algorithm of sha1 set `persistedDocuments.hashAlgorithm` + +```ts filename="codegen.ts" {10-12} +import { type CodegenConfig } from '@graphql-codegen/cli' + +const config: CodegenConfig = { + schema: 'schema.graphql', + documents: ['src/**/*.tsx'], + generates: { + './src/gql/': { + preset: 'client', + presetConfig: { + persistedDocuments: { + hashAlgorithm: 'sha256' + } + } + } + } +} +``` + ### Normalized Caches (urql and Apollo Client) Urql is a popular GraphQL client that utilizes a normalized cache.