Skip to content

Commit

Permalink
fix(gatsby-source-contentful): Correctly overwrite field type on Asse…
Browse files Browse the repository at this point in the history
…ts (#36337)
  • Loading branch information
LekoArts committed Aug 9, 2022
1 parent 0ed362c commit 6ecfe4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/contentful/package.json
Expand Up @@ -6,7 +6,6 @@
"dependencies": {
"@contentful/rich-text-types": "^14.1.2",
"gatsby": "next",
"gatsby-image": "next",
"gatsby-plugin-image": "next",
"gatsby-plugin-sharp": "next",
"gatsby-source-contentful": "next",
Expand Down Expand Up @@ -34,6 +33,7 @@
],
"license": "MIT",
"scripts": {
"clean": "gatsby clean",
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write '**/*.js'",
Expand Down
7 changes: 5 additions & 2 deletions packages/gatsby-source-contentful/src/extend-node-type.js
@@ -1,6 +1,7 @@
// @ts-check
import { stripIndent } from "common-tags"
import { GraphQLBoolean, GraphQLInt, GraphQLJSON } from "gatsby/graphql"
import { GraphQLBoolean, GraphQLInt } from "gatsby/graphql"
import { hasFeature } from "gatsby-plugin-utils"

import { resolveGatsbyImageData } from "./gatsby-plugin-image"
import { ImageCropFocusType, ImageResizingBehavior } from "./schemes"
Expand Down Expand Up @@ -42,7 +43,9 @@ export async function setFieldsOnGraphQLNodeType({ type, cache }) {
}
)

fieldConfig.type = GraphQLJSON
fieldConfig.type = hasFeature(`graphql-typegen`)
? `GatsbyImageData`
: `JSON`

return fieldConfig
}
Expand Down

0 comments on commit 6ecfe4a

Please sign in to comment.