apollo-mobx icon indicating copy to clipboard operation
apollo-mobx copied to clipboard

BUG: HoC does not work with mutations

Open geekflyer opened this issue 6 years ago • 2 comments

If I try to use the grapqhl hoc with a mutation my app crashes upon initialization with Uncaught (in promise) Error: Must contain a query definition.

For example:

const createOrgGroupMutation = gql`
    mutation createOrgGroup ($name: String!) {
        createOrgGroup(name: $name) {
            id
        }
    }
`;

export default graphql(createOrgGroupMutation)(CreateOrgGroupDialog);

If I use the graphql hoc from react-apollo this error does not occur.

geekflyer avatar Dec 17 '17 13:12 geekflyer

Yeah, that is not implemented. I use mutations differently using the "mutation" construct from this package. As I have usually 4-5 mutations per component that seemed to be a better option. Once I'll have a bit of time I'll look into this.

tomitrescak avatar Dec 17 '17 20:12 tomitrescak

@tomitrescak which mutation construct are you referring to? could you perhaps create an example? thanks

geekflyer avatar Dec 17 '17 21:12 geekflyer