{"action":"opened","issue":{"url":"https://api.github.com/repos/jaydenseric/apollo-upload-client/issues/49","repository_url":"https://api.github.com/repos/jaydenseric/apollo-upload-client","labels_url":"https://api.github.com/repos/jaydenseric/apollo-upload-client/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/jaydenseric/apollo-upload-client/issues/49/comments","events_url":"https://api.github.com/repos/jaydenseric/apollo-upload-client/issues/49/events","html_url":"https://github.com/jaydenseric/apollo-upload-client/issues/49","id":284677492,"number":49,"title":"\"Uncaught Error: Must contain a query definition\" when apollo-client v2 + compose + client option ","user":{"login":"github0013","id":809378,"avatar_url":"https://avatars0.githubusercontent.com/u/809378?v=4","gravatar_id":"","url":"https://api.github.com/users/github0013","html_url":"https://github.com/github0013","followers_url":"https://api.github.com/users/github0013/followers","following_url":"https://api.github.com/users/github0013/following{/other_user}","gists_url":"https://api.github.com/users/github0013/gists{/gist_id}","starred_url":"https://api.github.com/users/github0013/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github0013/subscriptions","organizations_url":"https://api.github.com/users/github0013/orgs","repos_url":"https://api.github.com/users/github0013/repos","events_url":"https://api.github.com/users/github0013/events{/privacy}","received_events_url":"https://api.github.com/users/github0013/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-27T08:47:48Z","updated_at":"2017-12-27T08:47:48Z","closed_at":null,"author_association":"NONE","body":"![localhost](https://user-images.githubusercontent.com/809378/34375859-0c05dd42-eb2c-11e7-8056-81bfc873302f.png)\r\n\r\n# environments\r\n```\r\n{\r\n  \"dependencies\": {\r\n    \"@types/react\": \"^16.0.28\",\r\n    \"@types/react-dom\": \"^16.0.3\",\r\n    \"apollo-client-preset\": \"^1.0.5\",\r\n    \"apollo-upload-client\": \"^7.0.0-alpha.1\",\r\n    \"babel-plugin-add-module-exports\": \"^0.2.1\",\r\n    \"babel-preset-env\": \"^1.6.1\",\r\n    \"babel-preset-es2015\": \"^6.24.1\",\r\n    \"babel-preset-react\": \"^6.24.1\",\r\n    \"babel-preset-stage-1\": \"^6.24.1\",\r\n    \"graphql\": \"^0.12.3\",\r\n    \"graphql-tag\": \"^2.6.1\",\r\n    \"parcel-bundler\": \"1.2.1\",\r\n    \"react\": \"^16.2.0\",\r\n    \"react-apollo\": \"^2.0.4\",\r\n    \"react-dom\": \"^16.2.0\",\r\n    \"typescript\": \"^2.6.2\"\r\n  }\r\n}\r\n\r\n```\r\n\r\nWhen I was trying to have a query and a mutation on a component, I encountered this error.\r\nVery simplified reproductive code is below.\r\n\r\n```tsx\r\nclass YourComponent extends React.Component<ChildProps<{}, QueryResponse & MutationResponse>, {}> {\r\n  render() {\r\n    console.log(this.props)\r\n    return <div>from YourComponent</div>\r\n  }\r\n}\r\n\r\nexport default compose(\r\n  graphql<QueryResponse>(QUERY),\r\n  graphql<MutationResponse>(MUTATION, {\r\n    options: props => ({\r\n      client: uploadClient\r\n    })\r\n  })\r\n)(YourComponent)\r\n```\r\n\r\n1. you have `compose` to build your graphql\r\n1. you have a query + a mutation\r\n1. you set a client through the options variable on the mutation\r\n\r\nIf I remove `options` and use the client in ApolloProvider `<ApolloProvider client={uploadClient}>`, then it will remove the error.\r\n\r\n```tsx\r\nexport default compose(\r\n  graphql<QueryResponse>(QUERY),\r\n  graphql<MutationResponse>(MUTATION)\r\n)(QueryAndMutation)\r\n\r\n```\r\n\r\nIs it maybe how I build graphql is irregular?"}}
{"actor":{"display_login":"github0013"}}