You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to have typed graphql mutations and queries to save me from myself. The generator creates some wonderful functions such as useLoginWithCredentialsMutation from code such as this.
These wonderful usexxxxMutation functions are generated when i use the plugin typescript-vue-apollo. However using the preset client as well creates duplicate constants.
Enabling both the preset and the plugin I get the document generated in both string and AST format
Of course, this does not work hence const LoginWithCredentialsDocument is declared twice.
I have tried several options and combinations in the codegen.yml file but with no luck
overwrite: trueschema: './schema.graphql'documents:
- './src/**/*.graphql.ts'generates:
./src/graphql/:
preset: 'client'config:
useDeduplication: trueconstEnums: trueenumsAsConst: trueenumsAsTypes: trueimmutableTypes: trueuseImplementingTypes: truevueCompositionApiImportFrom: vueuseTypeImports: truewithCompositionFunctions: truegqlImport: vue-apollo/graphqlplugins:
# Disable vue-apollo and generation will not create duplicate consts BUT the useLoginWithCredentialsMutation is also not generated.
- 'typescript-vue-apollo'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The Goal
I want to have typed graphql mutations and queries to save me from myself. The generator creates some wonderful functions such as
useLoginWithCredentialsMutationfrom code such as this.The Issue
These wonderful
usexxxxMutationfunctions are generated when i use the plugintypescript-vue-apollo. However using the presetclientas well creates duplicate constants.Enabling both the preset and the plugin I get the document generated in both string and AST format
Of course, this does not work hence
const LoginWithCredentialsDocumentis declared twice.I have tried several options and combinations in the
codegen.ymlfile but with no luckBeta Was this translation helpful? Give feedback.
All reactions