Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@graphql-codegen/typescript-operations dedupeFragments doesn't work #8967

Closed
DominicGBauer opened this issue Feb 7, 2023 · 0 comments · Fixed by #8971
Closed

@graphql-codegen/typescript-operations dedupeFragments doesn't work #8967

DominicGBauer opened this issue Feb 7, 2023 · 0 comments · Fixed by #8971

Comments

@DominicGBauer
Copy link

DominicGBauer commented Feb 7, 2023

Which packages are impacted by your issue?

@graphql-codegen/typescript-operations

Describe the bug

When adding dedupFragment: true to config it doesn't do anything.

codegen.yml:

  src/:
    preset: near-operation-file
    presetConfig:
      baseTypesPath: services/api/types.generated.ts
    plugins:
      - typescript-operations
          dedupFragment: true

Your Example Website or App

none

Steps to Reproduce the Bug or Issue

  1. Add a graphql query that has duplicated fragments
  2. Run the codegen with dedupFragment: true

Expected behavior

As a user I expect fragments to be deduplicated

Screenshots or Videos

No response

Platform

"@graphql-codegen/typescript-operations": "^3.0.0"

Codegen Config File

overwrite: true
schema:
  - "https://api-dev.nomanini.com/graphql":
      headers:
        Authorization: 'Bearer zzz'
        X-Nomanini-Organisation: 'zzz'
documents: 'src/**/*.graphql'
watchConfig:
  usePolling: true
  interval: 1000
generates:
  src/services/redux/api/types.generated.ts:
    plugins:
      - add:
          content: /* eslint-disable */
      - typescript
  src/services/redux/api/mocks.generated.ts:
    plugins:
      - add:
          content: '/* eslint-disable camelcase,no-underscore-dangle,@typescript-eslint/no-use-before-define,@typescript-eslint/no-unused-vars,no-prototype-builtins */'
      - typescript-mock-data:
          typesFile: './types.generated.ts'
          listElementCount: 2
          enumValues: change-case-all#pascalCase
          typenames: keep
  src/:
    preset: near-operation-file
    presetConfig:
      baseTypesPath: services/redux/api/types.generated.ts
    config:
      link:
        name: 'nomanini'
        endpoint: 'https://api-dev.nomanini.com/graphql'
    plugins:
      - add:
          content:  import { getEnv } from '@services/utils/general'
      - typescript-operations
          dedupFragment: true
      - typescript-rtk-query:
          importBaseApiFrom: '@services/redux/api/baseApi'
          importBaseApiAlternateName: 'graphqlApi'
          exportHooks: true
          overrideExisting: getEnv() === 'dev'
      - typescript-msw
  .graphql.schema.json:
    plugins:
      - introspection

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant