profile
viewpoint

Ask questionscontent model changes are not picked up for type generation

First of all, thanks for providing this awesome plugin!

Schema and type generation works perfectly and is very fast. The only thing that doesn't seem to work is picking up content model changes (i.e. Markdown). If I add, alter or remove a Markdown frontmatter field while running gatsby develop, the change is reflected in the remote schema at localhost:8000/___graphql, but generated schemas by gatsby-plugin-typegen are not updated, that only happens once when executing gatsby develop. If I just remove and add known properties from queries or fragments, type generation works instantly as expected.

I use the plugin together with the Apollo VS Code extension and consume the remote schema at localhost:8000/___graphql instead of the generated schema file in apollo.config.js to get IntelliSense for content model updates. However, type generation of the plugin fails, because it seems to not know about the schema update:

[typegen] An error on codegen
    GraphQLDocumentError: Cannot query field "testValue" on type "MarkdownRemarkFrontmatterForm".



  AggregateError: GraphQLDocumentError: Cannot query field "testValue" on type "MarkdownRemarkFrontmatterForm".
  
  - validate-documents.js:53 Object.checkValidationErrors
    [iacm-site]/[gatsby-plugin-typegen]/[@graphql-codegen]/core/dist/common/src/validate-documents.js:53:15
  
  - codegen.js:63 codegen
    [iacm-site]/[gatsby-plugin-typegen]/dist/graphql-codegen-core/src/codegen.js:63:9

Is it intentional that schema updates only happen at startup (e.g. performance reasons) or is this due to some misconfiguration by me or a bug?

cometkim/gatsby-plugin-typegen

Answer questions cometkim

Hey @nibtime, I just fixed this and published v2.2.0

Hope you enjoy :)

useful!

Related questions

No questions were found.
Github User Rank List