github dotansimha/graphql-code-generator release-1718272997249
June 13, 2024

latest releases: release-1732308151614, @graphql-codegen/visitor-plugin-common@5.6.0, @graphql-codegen/typescript@4.1.2...
5 months ago

@graphql-codegen/add@5.0.3

Patch Changes

  • #9987 5501c62 Thanks @taro-28! - Export configuration types (e.g. AddPluginConfig) from the entry point.

    import type { AddPluginConfig } from '@graphql-codegen/add';

@graphql-codegen/client-preset@4.3.0

Minor Changes

  • #10001 1be6e65 Thanks @n1ru4l! - Support discriminating null and undefined within the useFragment function.

    function MyComponent(props: FragmentType<typeof MyFragment> | null) {
      const data = useFragment(MyFragment, props);
      // data is `MyFragment | null`
    }
    
    function MyComponent(props: FragmentType<typeof MyFragment> | undefined) {
      const data = useFragment(MyFragment, props);
      // data is `MyFragment | undefined`
    }

    Before, the returned type from useFragment was always TType | null | undefined.

  • #9804 5e594ef Thanks @rachel-church! - Preserving Array<T> or ReadonlyArray<T> in useFragment() return type.

Patch Changes

  • #9996 99f449c Thanks @nahn20! - Added configuration to allow for custom hash functions for persisted documents in the client preset

    Example

    import { type CodegenConfig } from '@graphql-codegen/cli';
    
    const config: CodegenConfig = {
      schema: 'schema.graphql',
      documents: ['src/**/*.tsx'],
      generates: {
        './src/gql/': {
          preset: 'client',
          presetConfig: {
            persistedDocuments: {
              hashAlgorithm: operation => {
                const shasum = crypto.createHash('sha512');
                shasum.update(operation);
                return shasum.digest('hex');
              },
            },
          },
        },
      },
    };
  • Updated dependencies [5501c62]:

    • @graphql-codegen/add@5.0.3

Don't miss a new graphql-code-generator release

NewReleases is sending notifications on new releases.