From ecd13d4682d7106e6733a1ce9cb1b3d4519c1be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Mon, 22 Feb 2021 17:28:48 +0100 Subject: [PATCH 1/3] refactor(graphql): migrate to new interface inheritance syntax --- packages/gatsby-source-contentful/src/gatsby-node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 1fbc0c8b0a4e0..897efa1de1a64 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -325,7 +325,7 @@ exports.sourceNodes = async ( } createTypes(` - interface ContentfulEntry @nodeInterface { + interface ContentfulEntry implements Node { contentful_id: String! id: ID! node_locale: String! From a01830729aa91b284e426968c60c626ec71a2ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Mon, 22 Feb 2021 17:58:43 +0100 Subject: [PATCH 2/3] refactor: pass whole nodes when touching for keep alive --- packages/gatsby-source-contentful/src/gatsby-node.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 897efa1de1a64..8d1290532fcad 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -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({ ...node, id: node.localFile___NODE }) } }) @@ -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) }) } @@ -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 From 9f207cc849d1c16d1e0a42fdeb44b44c3f10e535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Mon, 8 Mar 2021 15:45:53 +0100 Subject: [PATCH 3/3] use getNode syntax --- packages/gatsby-source-contentful/src/gatsby-node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 8d1290532fcad..8c321b4dc515d 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -250,7 +250,7 @@ exports.sourceNodes = async ( touchNode(node) if (node.localFile___NODE) { // Prevent GraphQL type inference from crashing on this property - touchNode({ ...node, id: node.localFile___NODE }) + touchNode(getNode(node.localFile___NODE)) } })