Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby): Extend fields when merging types #18500

Merged
merged 3 commits into from
Oct 14, 2019

Conversation

stefanprobst
Copy link
Contributor

When merging GraphQL types, we are currently using graphql-compose, which internally uses addFields, which will replace the full fieldConfig on an existing field with a new one. This is a problem e.g. for gatsby-plugin-schema-snapshot when merging the field type, any existing resolver will be lost:

// gatsby-node.js
exports.createSchemaCustomization = ({ actions }) =>
  actions.createTypes(`
    type Mdx implements Node {
      # This will overwrite the full field config on Mdx.body with { type: String }
      # so the resolver defined by gatsby-plugin-mdx is lost
      body: String!
    }
  `)

This PR changes this to use extendField instead of addFields

Fixes: #18095

@stefanprobst stefanprobst requested a review from a team as a code owner October 11, 2019 10:24
@lannonbr lannonbr added the topic: GraphQL Related to Gatsby's GraphQL layer label Oct 11, 2019
Copy link
Contributor

@freiksenet freiksenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to have you back!

@freiksenet freiksenet added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Oct 14, 2019
@gatsbybot gatsbybot merged commit 302aa26 into gatsbyjs:master Oct 14, 2019
@stefanprobst stefanprobst deleted the merge-fieldconfigs branch October 15, 2019 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: GraphQL Related to Gatsby's GraphQL layer
4 participants