Skip to content

Commit

Permalink
fix(docs): show where getNodesByType comes from (#25344)
Browse files Browse the repository at this point in the history
* show where getNodesByType comes from

* indicate the code is an example per PR feedback

Co-authored-by: Marcy Sutton <marcy@gatsbyjs.com>

Co-authored-by: Marcy Sutton <marcy@gatsbyjs.com>
  • Loading branch information
2 people authored and KyleAMathews committed Jul 29, 2020
1 parent d482be3 commit d3ef12d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/creating-a-source-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ One challenge when developing locally is that a developer might make modificatio

If possible, the proactive listener approach creates the best experience if existing APIs in the data source can support it (or you have access to build support into the data source).

The code to support this behavior looks like this:
Here's some pseudo code that shows this behavior:

```javascript:title=source-plugin/gatsby-node.js
exports.sourceNodes = async ({ actions }, pluginOptions) => {
exports.sourceNodes = async ({ actions, getNodesByType }, pluginOptions) => {
const { createNode, touchNode, deleteNode } = actions

// highlight-start
Expand Down

0 comments on commit d3ef12d

Please sign in to comment.