Skip to content

Commit

Permalink
docs(migrating-from-v3-to-v4): correct getNode snippet (#34543)
Browse files Browse the repository at this point in the history
  • Loading branch information
homearanya authored Jan 19, 2022
1 parent d39265f commit 195188c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/reference/release-notes/migrating-from-v3-to-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ exports.sourceNodes = ({ actions, getNodesByType }) => {
In case you only have an ID at hand (e.g. getting it from cache), you can use the `getNode()` API:

```js:title=gatsby-node.js
exports.sourceNodes = async ({ actions, getNodesByType, cache }) => {
const { touchNode, getNode } = actions
exports.sourceNodes = async ({ actions, getNode, getNodesByType, cache }) => {
const { touchNode } = actions
const myNodeId = await cache.get("some-key")

touchNode(getNode(myNodeId)) // highlight-line
Expand Down

0 comments on commit 195188c

Please sign in to comment.