Closed carstenblt closed 2 years ago
To clarify,
you have one GraphQL backend, and you use it as both static and runtime queries at the same time. And you understand:
In this case, as you say, the plugin shouldn't parse any queries provided by Apollo, so it's an obvious bug. Can you provide settings and snippets?
Right, even though at first I thought gatsby-plugin-typegen might be hackable to do both.
So my typical code looks like this:
import { graphql } from "gatsby";
import { gql } from "apollo-boost";
export const pageQuery = graphql`
query {
backend {
someQuery
}
`
...
const otherQuery = await AClient.query({
query: gql`{
someOtherQuery
}
`
});
with my gatsby-config.js plugins set up
{
resolve: "gatsby-source-graphql",
options: {
typeName: "Backend",
fieldName: "backend",
url: "https://backend",
},
},
I saw you just filed another issue https://github.com/dotansimha/graphql-code-generator/issues/4586
if this problem is caused in graphql-codegen config without this plugin. then I can track this as an upstream issue and contribute to there. will let you know after looking at the details and finding any workaround.
This is fixed in v3 (current RC)
v3 relies on Gatsby's SET_GRAPHQL_DEFINITIONS API
and doesn't use graphql-tag-pluck anymore.
I am using gatsby-source-graphql to make remote data available under a given
fieldName
/namespace. I am accessing the same backend source with the Apollo client directly but without the fieldName that is defined for gatsby-source-graphql.From my understanding this is breaking the plugin for me right now. I get
Cannot query field ... on type "Query"
for all Apollo calls. Is there either a way toThank you for your help!