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

Fragments are imported but not used (because not spread anymore) #289

Open
adrienharnay opened this issue Mar 1, 2023 · 0 comments
Open

Comments

@adrienharnay
Copy link

Which packages are impacted by your issue?

No response

Describe the bug

Related to: #140 (comment)

When running the codegen, fragments are imported (like before), but not used anymore. This generated a TS error.

Your Example Website or App

https://codesandbox.io/s/gql-code-generator-without-dedup-fragments-forked-35lp34?file=/src/user.fragment.generated.tsx

Steps to Reproduce the Bug or Issue

  1. Run yarn codegen
  2. Open src/user.fragment.generated.tsx
  3. See bug

Expected behavior

I would expect the fragments to not be imported anymore.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • NodeJS: 18.11.0
  • graphql 16.6.0

"@graphql-codegen/add": "3.2.3",
"@graphql-codegen/cli": "2.16.4",
"@graphql-codegen/introspection": "2.2.3",
"@graphql-codegen/near-operation-file-preset": "2.5.0",
"@graphql-codegen/typed-document-node": "2.3.12",
"@graphql-codegen/typescript": "2.8.7",
"@graphql-codegen/typescript-operations": "2.5.12",

Codegen Config File

schema: schema.graphql
documents: 'src/**/*.graphql'
generates:
src/:
preset: near-operation-file
presetConfig:
baseTypesPath: types.ts
extension: .generated.tsx
plugins:
- typescript
- typescript-operations
- typed-document-node
config:
onlyOperationTypes: true
preResolveTypes: true
inlineFragmentTypes: 'combine'

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

No branches or pull requests

1 participant