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

Improve and test compatibility with GraphQLJSON #217

Closed
asbjornenge opened this issue May 13, 2016 · 8 comments
Closed

Improve and test compatibility with GraphQLJSON #217

asbjornenge opened this issue May 13, 2016 · 8 comments

Comments

@asbjornenge
Copy link

Hi! I'm trying to use apollo-client with GraphQLJSON.

Using the below mutation I am able to send the correct data to GraphQL. The problem arise when I try to query for data that includes settings (e.g. the response from this mutation). I get TypeError: Cannot read property 'selections' of null at writeSelectionSetToStore. It works if settings is null. It also works fine in the /graphql query app.

function mapMutationsToProps({ ownProps, state }) {
  return {
    updateClub: (variables) => ({
      mutation: gql`
        mutation updateClub(
          $uid: String!
          $name: String!
          $settings: JSON!
        ) {
          updateClub(
            uid: $uid
            name: $name
            settings: $settings
         ) {
            uid,
            name,
            settings
          }
        }
      `,
      variables: variables,
    })
  }
}

Any help would be greatly appreciated 😄 🌈

@asbjornenge
Copy link
Author

I guess the actual question is: "Is there a way to add additional scalar types in apollo-client" ? 😛

@stubailo
Copy link
Contributor

Can you paste in the response from the graphql server in this case? That will let me write a test to reproduce the issue!

@asbjornenge
Copy link
Author

This is what I get using /graphql (graphiql) if that's what you mean?

{
  "data": {
    "updateClub": {
      "uid": "1d7f836018fc11e68d809dfee940f657",
      "name": "Eple",
      "settings": {
        "name": "eple",
        "currency": "AFN",
        "calendarStretch": "2",
        "defaultPreAllocationPeriod": "1",
        "confirmationEmailCopy": null,
        "emailDomains": null
      }
    }
  }
}

Or is there some other convenient way to see the reponse?

@stubailo
Copy link
Contributor

That's perfect! Another way to see it is to look in your Chrome dev tools under the Network tab.

@stubailo stubailo changed the title GraphQLJSON Improve and test compatibility with GraphQLJSON May 13, 2016
@stubailo
Copy link
Contributor

Got the test going! 4babe24

@stubailo
Copy link
Contributor

Aaaand, it's fixed - that was easy! Now just to wait for CI to pass and republish. #219

@stubailo
Copy link
Contributor

Published in NPM as 0.3.8, let me know if it works for you!

@asbjornenge
Copy link
Author

@stubailo works like a charm! Thanks a bunch ❤️ 🌈 🚀

jbaxleyiii pushed a commit that referenced this issue Oct 17, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants