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

fix(visitor-plugin-common): incorrect gqlImport alias #9660

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HelloWorld017
Copy link

@HelloWorld017 HelloWorld017 commented Sep 5, 2023

Description

When I uses the gqlImport config with plugins, which utilizes visitor-plugin-common, it tends to create invalid gql tagged template.

For example, with config, gqlImport: './path/to/pragma#myPragma, it generates like this:

import { myPragma as gql } from './path/to/pragma';
export const SomeQuery = myPragma`
//                       ^^^^^^^^
`;

Related #5460

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I have generated some queries which are used in the production, with this modification, in my local. (w/ typescript-document-nodes plugin).

If it needs extra test codes, I'll update it later.

Test Environment:

  • OS: macOS 13.1
  • @graphql-codegen/typescript: 2.7.3
  • @graphql-codegen/typescript-operations: 2.5.3
  • @graphql-codegen/typescript-document-nodes: 4.0.1
  • @graphql-codegen/visitor-plugin-common: 4.0.1
  • NodeJS: 18.16.1

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
    • N/A
  • I have made corresponding changes to the documentation
    • N/A
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

N/A

@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2023

🦋 Changeset detected

Latest commit: db8e4ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@graphql-codegen/visitor-plugin-common Patch
@graphql-codegen/typescript-document-nodes Patch
@graphql-codegen/gql-tag-operations Patch
@graphql-codegen/typescript-operations Patch
@graphql-codegen/typescript-resolvers Patch
@graphql-codegen/typed-document-node Patch
@graphql-codegen/typescript Patch
@graphql-codegen/graphql-modules-preset Patch
@graphql-codegen/client-preset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@HelloWorld017 HelloWorld017 marked this pull request as ready for review November 5, 2023 12:45
Do not use propName, as the import is aliased with `gql`.

Fixes dotansimha#5460
Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a changeset as mentioned in #9660 (comment)?

@HelloWorld017
Copy link
Author

Can you please add a changeset as mentioned in #9660 (comment)?

I have added them in db8e4ba ! Thank you :)

@Urigo
Copy link
Collaborator

Urigo commented Nov 19, 2023

@HelloWorld017 thank you for your contribution!
does it make sense to add a test that covers this case?

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 this pull request may close these issues.

None yet

3 participants