Closed
Description
Is there a way to map multiple objects from a single query? It currently seems to expect one object to equal one query.
Right now it seems that I either need to do multiple queries, like below (my queries are defined as constants elsewhere). This results in two queries or I can turn on batch to do one query but that requires changing our backend to accommodate that batched format (we are not using Apollo Server).
apollo: {
clients: {
query: clientQuery,
loadingKey: 'loading'
}
,
client_statuses: {
query: clientStatusesQuery,
loadingKey: 'loading'
}
}
or I have to use the Apollo Client directly to separate it out, like below.
created() {
this.$apollo.query({
query: clientsAndStatusesQuery
})
.then(result => {
this.clients = result.data.clients
this.client_statuses = result.data.client_statuses
});
},
Another note, in the example it says to use watchQuery. I get "Uncaught TypeError: this.$apollo.watchQuery(...).then is not a function(…)". But just "query" works fine.
Any help would be appreciated! Thank you!
Metadata
Metadata
Assignees
Labels
No labels