Skip to content

Commit

Permalink
contentful <3 gatsby v3 (#29675) (#30173)
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>
(cherry picked from commit bce0b21)

Co-authored-by: Benedikt Rötsch <axe312ger@users.noreply.github.com>
  • Loading branch information
GatsbyJS Bot and axe312ger authored Mar 10, 2021
1 parent b7d82da commit 0331c51
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 @@ -247,10 +247,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 @@ -325,7 +325,7 @@ exports.sourceNodes = async (
}

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

localizedNodes.forEach(node => {
// touchNode first, to populate typeOwners & avoid erroring
touchNode({ nodeId: node.id })
touchNode(node)
deleteNode(node)
})
}
Expand All @@ -495,7 +495,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 0331c51

Please sign in to comment.