github dotansimha/graphql-code-generator @graphql-codegen/typescript-react-query@3.0.0

latest releases: release-1722174286560, @graphql-codegen/client-preset@4.3.3, release-1719908762705...
3 years ago

Major Changes

  • 545c470: Change fetchParams configuration option from object to string.The string will be inserted 1:1 into the generated code. This is a breaking change!

    This allows more flexibility for customization. Here are some examples:

    Use an imported object for configuration

    schema: MY_SCHEMA_PATH
    documents: './src/**/*.graphql'
    generates:
      ./generates.ts:
        plugins:
          - add:
              content: "import { endpointUrl, fetchParams } from './my-config';"
          - typescript
          - typescript-operations
          - typescript-react-query
        config:
          fetcher:
            endpoint: 'endpointUrl'
            fetchParams: 'fetchParams'

    Use environment variables for configuration

    schema: MY_SCHEMA_PATH
    documents: './src/**/*.graphql'
    generates:
      ./generates.ts:
        plugins:
          - typescript
          - typescript-operations
          - typescript-react-query
        config:
          fetcher:
            endpoint: 'endpointUrl'
            # Multiline string
            fetchParams: >
              {
                headers: {
                  apiKey: process.env.APIKEY,
                  somethingElse: process.env.SOMETHING,
                },
              }
  • 5dc59c8: Queries without variables will no longer have an undefined entry in their query key

Minor Changes

  • 99af506: Allow passing headers to graphql-request.

Patch Changes

  • ec2cba5: [typescript-react-query] Pass dataSource as argument to fetcher

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

NewReleases is sending notifications on new releases.