From 3794b9c5ffbb9679660f92b42bf54f7cba769c9f Mon Sep 17 00:00:00 2001 From: LekoArts Date: Mon, 3 Jan 2022 14:33:39 +0100 Subject: [PATCH 1/3] initial --- .../how-to/plugins-and-themes/creating-a-source-plugin.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md b/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md index 80b2abce26fd9..cd7a36b03c0b5 100644 --- a/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md +++ b/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md @@ -526,8 +526,9 @@ Then export a new function `onCreateNode`, and call `createRemoteFileNode` in it exports.onCreateNode = async ({ node, // the node that was just created actions: { createNode, createNodeField }, + store, + cache, createNodeId, - getCache, }) => { if (node.internal.type === POST_NODE_TYPE) { const fileNode = await createRemoteFileNode({ @@ -536,7 +537,8 @@ exports.onCreateNode = async ({ parentNodeId: node.id, createNode, createNodeId, - getCache, + cache, + store, }) if (fileNode) { From bdc0fb97a0f51204cdd768026fb664b16ab505d2 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Mon, 3 Jan 2022 15:41:01 +0100 Subject: [PATCH 2/3] Revert "initial" This reverts commit 3794b9c5ffbb9679660f92b42bf54f7cba769c9f. --- .../how-to/plugins-and-themes/creating-a-source-plugin.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md b/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md index cd7a36b03c0b5..80b2abce26fd9 100644 --- a/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md +++ b/docs/docs/how-to/plugins-and-themes/creating-a-source-plugin.md @@ -526,9 +526,8 @@ Then export a new function `onCreateNode`, and call `createRemoteFileNode` in it exports.onCreateNode = async ({ node, // the node that was just created actions: { createNode, createNodeField }, - store, - cache, createNodeId, + getCache, }) => { if (node.internal.type === POST_NODE_TYPE) { const fileNode = await createRemoteFileNode({ @@ -537,8 +536,7 @@ exports.onCreateNode = async ({ parentNodeId: node.id, createNode, createNodeId, - cache, - store, + getCache, }) if (fileNode) { From b57517d777dc98cdcb7c92ba85f0893f9a38dd66 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Mon, 3 Jan 2022 15:44:33 +0100 Subject: [PATCH 3/3] update doc --- .../images-and-media/preprocessing-external-images.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/docs/how-to/images-and-media/preprocessing-external-images.md b/docs/docs/how-to/images-and-media/preprocessing-external-images.md index a145fb2e4eaec..14f06688be957 100644 --- a/docs/docs/how-to/images-and-media/preprocessing-external-images.md +++ b/docs/docs/how-to/images-and-media/preprocessing-external-images.md @@ -57,9 +57,8 @@ exports.createSchemaCustomization = ({ actions }) => { exports.onCreateNode = async ({ node, actions: { createNode, createNodeField }, - store, - cache, createNodeId, + getCache, }) => { // For all MarkdownRemark nodes that have a featured image url, call createRemoteFileNode if ( @@ -71,8 +70,7 @@ exports.onCreateNode = async ({ parentNodeId: node.id, // id of the parent node of the fileNode you are going to create createNode, // helper function in gatsby-node to generate the node createNodeId, // helper function in gatsby-node to generate the node id - cache, // Gatsby's cache - store, // Gatsby's Redux store + getCache, }) // if the file was created, extend the node with "localFile"