Replies: 3 comments 8 replies
-
Same problem here. Actually, executing |
Beta Was this translation helpful? Give feedback.
-
The documentation says the following about
So it would make sense that the GraphQl schema doesn't update anymore, because it's already created. I'm also in need of creating new nodes in |
Beta Was this translation helpful? Give feedback.
-
Can you elaborate a bit on what you are trying to achieve? Why do you need to call |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Am I not allowed to create a node from inside createPages in gatsby-node.js? I can call actions.createNode from createPages, and when running Gatsby the total number of nodes reflects the nodes created from inside createPages, however, those don't seem to be added to GraphQL at all.
I've created a Code Sandbox which creates nodes both from createPages and from onCreateNode. As you can see, only nodes created within onCreateNode are added to GraphQL, while the ones created from createPages don't show up in GraphQL at all, even though Gatsby does seem to do something with them since adding new nodes there changes the output of "Total nodes" in the console when running "gatsby develop".
Is this a bug or am I misunderstanding something?
If it matters, I'm fetching all my data when Gatsby runs createPages, and from there I create all my custom pages and nodes, both of which depend on my data. If I have to split page and node creation into two functions then I'll need to fetch my data twice, which doesn't make sense.
I understand I don't have to create my pages/nodes manually, and that there are a whole bunch of plugins to help out with all of that, but in this particular case I'd like to do it manually. If createPages exposes actions.createNode then that should actually create a node, no?
Beta Was this translation helpful? Give feedback.
All reactions