-
DescriptionWe are using gatsby-plugin-page-creator in conjunction with gatsby-source-wordpress-experimental to create our FAQ's section. On the WordPress side, we have a hidden page with WordPress Custom Fields which provides us with all FAQ data. We fetch this hidden page via gatsby-source-wordpress-experimental and in We obtain one JSON blob of all These new GQL nodes are used to create pages via new gatsby-plugin-page-creator FS routes API. We have a following folder structure
And it works great. Except, when we stop the dev-server and run it again, the
We have some more pages generated from WordPress data and all of them fails, when we run dev-server with populated cache. As a remedy, we run Steps to reproduceIn our (very complicated and, unfortunately, private) repo, run Expected resultRunning Actual resultWhen the Gatsby cache is populated, the EnvironmentSystem: I have team of 4 and all of them have the same issue. Unfortunately, all of them have MacOS, so I cannot confirm weather it happens on another platform too. ReproductionI tried to reproduce this issue on minimal setup but it only occurs in our big repo. I can share at least the relevant code with you. package.json
gatsby-config.js
gatsby-node.js
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi! We'll need a minimal reproduction for this. However, I have an idea what it might be: https://www.gatsbyjs.com/docs/node-creation/#freshstale-nodes
On your first run without a cache all nodes are "fresh" so they are all created. But on further runs your newly created nodes inside The source plugin tutorial also touches (heh) on this API: |
Beta Was this translation helpful? Give feedback.
-
@LekoArts fantastic. I have put the code
to the test and so far, it seems to resolve the issue. Thank you for the link to the "Creating a Source Plugin", this is the part of the documentation, which I not yet discovered. I will read it through and through. |
Beta Was this translation helpful? Give feedback.
Hi!
We'll need a minimal reproduction for this. However, I have an idea what it might be:
https://www.gatsbyjs.com/docs/node-creation/#freshstale-nodes
On your first run without a cache all nodes are "fresh" so they are all created. But on further runs your newly created nodes inside
onCreateNode
are probably not "touched" and thus garbage collected.This can happen when you e.g. don't set the
parent
when it's necessary.The source plugin tutorial also touches (heh) on this API:
https://www.gatsbyjs.com/docs…