Skip to content

Commit

Permalink
contentful <3 gatsby v3 (#29675)
Browse files Browse the repository at this point in the history
* refactor(graphql): migrate to new interface inheritance syntax

* refactor: pass whole nodes when touching for keep alive

* use getNode syntax

Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
  • Loading branch information
axe312ger and gatsbybot authored Mar 10, 2021
1 parent 0a6c6eb commit bce0b21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/gatsby-source-contentful/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ exports.sourceNodes = async (
if (node.internal.owner !== `gatsby-source-contentful`) {
return
}
touchNode({ nodeId: node.id })
touchNode(node)
if (node.localFile___NODE) {
// Prevent GraphQL type inference from crashing on this property
touchNode({ nodeId: node.localFile___NODE })
touchNode(getNode(node.localFile___NODE))
}
})

Expand Down Expand Up @@ -329,7 +329,7 @@ exports.sourceNodes = async (
}

createTypes(`
interface ContentfulEntry @nodeInterface {
interface ContentfulEntry implements Node {
contentful_id: String!
id: ID!
node_locale: String!
Expand Down Expand Up @@ -488,7 +488,7 @@ exports.sourceNodes = async (

localizedNodes.forEach(node => {
// touchNode first, to populate typeOwners & avoid erroring
touchNode({ nodeId: node.id })
touchNode(node)
deleteNode(node)
})
}
Expand All @@ -499,7 +499,7 @@ exports.sourceNodes = async (
const existingNodes = getNodes().filter(
n => n.internal.owner === `gatsby-source-contentful`
)
existingNodes.forEach(n => touchNode({ nodeId: n.id }))
existingNodes.forEach(n => touchNode(n))

const assets = mergedSyncData.assets

Expand Down

0 comments on commit bce0b21

Please sign in to comment.