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

Empty variables in mapQueriesToProps throws #441

Closed
woniesong92 opened this issue Jul 21, 2016 · 1 comment
Closed

Empty variables in mapQueriesToProps throws #441

woniesong92 opened this issue Jul 21, 2016 · 1 comment

Comments

@woniesong92
Copy link

const mapQueriesToProps = ({ ownProps, state }) => {
  return {
    post: {
      query: gql`
        query {
          post(id: 1) {
            title
            body
          }
        }
      `
    },
    variables: {}
  };
}

If you pass in an empty object {} to variables, you get the following error.

TypeError: Cannot read property 'definitions' of undefined
@stubailo
Copy link
Contributor

@woniesong92 I think you have the variables in the wrong object - it should be inside post, like this:

const mapQueriesToProps = ({ ownProps, state }) => {
  return {
    post: {
      query: gql`
        query {
          post(id: 1) {
            title
            body
          }
        }
      `,
      variables: {}
    },
  };
}

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