How to recreate/update gatsby source nodes
See original GitHub issueI’m creating a couple source nodes with gatby’s sourceNodes
API. I noticed that in development mode all nodes are correctly created when the dev server is started, but as I work on my app the nodes become stale due to changes in the data they are reading.
I’m wondering if there’s any API or examples I can see that will show me how to update (or re-create) these source nodes while the dev server is running.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Creating a Source Plugin - Gatsby
At a high-level, a source plugin: Ensures the data in the Gatsby DB is synced with the latest updates from its source; Creates...
Read more >How To Create a Custom Source Plugin in Gatsby
Step 1 — Scaffolding Files and Installing Dependencies · Step 2 — Loading and Configuring the Plugin · Step 3 — Pulling Raw...
Read more >Gatsby JS Source Plugin Tutorial Step by Step for Beginners
Run Yarn link to create a symlink to the plugin folder you just created. This will allow you to move or rename the...
Read more >How to Build a Gatsby Source Plugin, using Hashnode as an ...
The implementation · fetch all posts of a user from the API · loop through each post and create a node for it...
Read more >Build your own Gatsby Source Plugin and Publish it to NPM ...
In this video tutorial we will create a Gatsby source plugin, and publish it to NPM!
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok I think I figured it out, wanted to add it here incase anyone runs into this in the future.
https://www.gatsbyjs.org/docs/creating-a-source-plugin/#option-1-transformation-relationships
The trick is to use
createParentChildLink
between your node and the node that represents the file on disk (which you can get from onCreateNode).Thanks again!
@ryanto I have similar question with you, and figure out about
createParentChildLink
but have no clue, can I know how you implement it? Thanks