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

Breaking change in 0.1.17? #19

Closed
ClementParis016 opened this issue Nov 19, 2016 · 5 comments
Closed

Breaking change in 0.1.17? #19

ClementParis016 opened this issue Nov 19, 2016 · 5 comments

Comments

@ClementParis016
Copy link

I was using graphql-tag 0.1.16 along apollo-client 0.5.0, then updated to 0.1.17 and 0.5.6 respectively, which introduced the following TypeError: Cannot read property 'kind' of undefined raised from graphql-tag on GraphQL mutations.

This is what my mutation looks like:

  apollo.mutate({
      mutation: gql`
        mutation {
          newEntry(input: {
            name: "${entry.name}",
            description: "${entry.description}"
          }) {
            entryInfo {
              name,
              description
            }
          }
        }
      `
    });

Though I'm really new to GraphQL so I'm afraid I can't get what kind could refer to :/

@stubailo
Copy link
Contributor

stubailo commented Dec 1, 2016

@tmeasday perhaps we should have a check for the data being a string so that interpolation keeps working?

@ClementParis016 the right way to do this is via variables. Using string interpolation for dynamic inputs is not good because you could end up with escaping issues.

@tmeasday
Copy link
Contributor

tmeasday commented Dec 1, 2016

Oh, ughh, this is a bad bug. We should have a test for this. Even if we don't encourage it, people defintitely do it.

@stubailo
Copy link
Contributor

stubailo commented Dec 1, 2016

Agreed.

@tmeasday
Copy link
Contributor

tmeasday commented Dec 1, 2016

@ClementParis016 for the record: I think you were interpolating undefined, so there is probably a bug at your end -- I doubt that name: "undefined" was what you wanted in your query!

In any case, this is fixed in 1.1.2

@tmeasday tmeasday closed this as completed Dec 1, 2016
@ClementParis016
Copy link
Author

Thanks for your help. I sort of felt that using interpolation wasn't great because I had to wrap strings in quotes to get it to work.
I will look into using GraphQL variables instead, thank you 👍

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

3 participants