Skip to content

Commit 240dfac

Browse files
authored
chore: update using-image-processing example (#36421)
1 parent b361081 commit 240dfac

File tree

1 file changed

+7
-14
lines changed
  • examples/using-gatsby-image/plugins/gatsby-source-remote-images

1 file changed

+7
-14
lines changed

examples/using-gatsby-image/plugins/gatsby-source-remote-images/gatsby-node.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
const { createRemoteFileNode } = require(`gatsby-source-filesystem`)
22

33
exports.onCreateNode = async (
4-
{
5-
actions: { createNode },
6-
node,
7-
createContentDigest,
8-
store,
9-
cache,
10-
reporter,
11-
},
12-
{ filter, nodeName = `localFile` }
4+
{ actions: { createNode, createNodeField }, node, createNodeId, getCache },
5+
{ filter }
136
) => {
147
if (filter(node)) {
158
const fileNode = await createRemoteFileNode({
169
url: node.url,
17-
cache,
10+
parentNodeId: node.id,
11+
getCache,
1812
createNode,
19-
createNodeId: createContentDigest,
13+
createNodeId,
2014
})
2115

2216
if (fileNode) {
23-
const fileNodeLink = `${nodeName}___NODE`
24-
node[fileNodeLink] = fileNode.id
17+
createNodeField({ node, name: "localFile", value: fileNode.id })
2518
}
2619
}
2720
}
@@ -35,7 +28,7 @@ exports.createSchemaCustomization = ({ actions }) => {
3528
title: String
3629
credit: String
3730
gallery: Boolean
38-
localFile: File @link(from: "localFile___NODE")
31+
localFile: File @link(from: "fields.localFile")
3932
}
4033
4134
`)

0 commit comments

Comments
 (0)