I'm using vue-apollo + vue-property-decorator. I'm able to run queries just fine like this:
get apollo () {
return {
rc_tags: {
query: gql`{ <body of query> }`
}
}
}
But if I try to use a property of the component for the query, e.g. from a file
MYQUERY = gql`{ <body of query> }`
get apollo () {
return {
rc_tags: {
query: MYQUERY
}
}
}
Then I get the error:
Invariant Violation: Expecting a parsed GraphQL document.
Perhaps you need to wrap the query string in a "gql" tag?
It doesn't matter if I import MYQUERY from another file as in the example above, or if it's a property of the local component, same error. I can mouse-over MYQUERY and get a TypeScript hint that it's a DocumentNode, but no matter what I do, I can't get it to work without putting the full template literal inside the actual get apollo ()
function.