Import multiple mutation as alias
See original GitHub issueimport { default as submitAnswers } from '../../gql/mutations/submitAnswers';
import { default as submit } from '../../gql/mutations/submit';
this.get('apollo').mutate({ submitAnswers, variables }, 'submitAnswers')
throws an error -> TypeError: Cannot read property ‘kind’ of undefined at checkDocument
What is the proper way of using 2 mutations in the same controller?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
GraphQL aliases for multiple actions - Skedulo Developer
Skedulo GraphQL supports mutations that include aliases for performing multiple actions. All mutations in a schema block are performed in a transaction, which ......
Read more >composing multiple/reusable mutation components? #1867
We want to use the Mutation component, but conditionally execute on two Mutations (dependent on a prop received by the component it wraps)....
Read more >Mutations in Apollo Kotlin - Apollo GraphQL Docs
Mutations are GraphQL operations that modify back-end data. As a convention in GraphQL, queries are read operations and mutations are write operations.
Read more >Use Variables / Aliases / Fragments / Directives in Queries
Use variables, aliases, fragments and directives in Hasura queries. ... Aliases can be used to return objects with a different name than their...
Read more >How to insert many mutations in a single GraphQL request?
Also like other queries, if you want to request the same field multiple times (run similarly-named mutations) you need to use an alias...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works for me
Running
ember@2.14.1
andember-apollo-client@0.3.2
I also ran into a problem when wanting an alias, such as:import organizationsQuery from 'my-project/gql/queries/organizations'
I would receive the error of
Error: query option is required. You must specify your GraphQL document in the query option.
Converting my call from
this.get('apollo').queryOnce({organizationsQuery})
to
this.get('apollo').queryOnce({query: organizationsQuery})
resolved the issue though, just as it did for @m0rgul
This makes sense though since when it was imported as
query
instead oforganizationsQuery
the ES6 syntax of.queryOnce({query})
was being interpreted as.queryOnce({query: query})
whereas.queryOnce({organizationsQuery})
is interpreted as.queryOnce({organizationsQuery: organizationsQuery})
which is an incorrect property to pass toqueryOnce()