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, gql template literals, and including fragments #2640

Closed
baerrach opened this issue Aug 19, 2017 · 2 comments
Closed

GraphQL, gql template literals, and including fragments #2640

baerrach opened this issue Aug 19, 2017 · 2 comments
Labels
lang:graphql Issues affecting GraphQL locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@baerrach
Copy link

baerrach commented Aug 19, 2017

Currently I am writing my graphql in a *.js file, where the query is referencing the fragment from a JavaScript variable that contains the fragment gql. However prettier doesn't recognise the ${} stuff and isn't reformatting the code.

Its entirely possible I'm not doing this in the recommended way (e.g. not using *.graphql files). Updates to existing documentation to put people on the right path would be appreciated.

fragments {
  all: gql`...`,
};

query = gql`
query allPartsByManufacturerName(
  $name: String!
) {
  allParts(filter:{
    manufacturer: {
      name: $name
    }
  }) {
    ...PartAll
  }
}
${fragments.all}
@azz
Copy link
Member

azz commented Aug 19, 2017

We don't currently support expressions inside tagged template GraphQL literals. We should add this.

@azz azz added the type:enhancement A potential new feature to be added, or an improvement to how we print something label Aug 19, 2017
@azz azz added the lang:graphql Issues affecting GraphQL label Oct 1, 2017
@lydell
Copy link
Member

lydell commented Sep 23, 2018

This was fixed by #3370 🎉

See also: #4404

@lydell lydell closed this as completed Sep 23, 2018
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Dec 22, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:graphql Issues affecting GraphQL locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

No branches or pull requests

3 participants