datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 50 forks source link

Having trouble accessing tree data inside of node when using getNodeByType #158

Closed cmaycumber closed 3 years ago

cmaycumber commented 3 years ago

I'm having trouble accessing the data related to the tree structure in Dato when using getNodeByType inside of sourceNodes in gatsby-node.js.

It currently provides all the information in attributes on a given node that we set by fails to include indicators of the position of the item in the tree, root, in my case.

Note: This seemed to be a recent problem for us after upgrading to the latest version.

cmaycumber commented 3 years ago

If I was too vague with my previous explanation I don't mind trying to add some clarification. This is the only thing keeping us from flipping our site from the newer gatsby image because it's breaking a custom navigation structure that we've set up in gatsby.

Let me know if I can provide some more insight.

stefanoverna commented 3 years ago

There should be a "position" attribute for that. If you can share Gatsby version, dato plugin version, Dato project ID and a snippet of code reproducing the issue (the one that before worked and now it doesn't) that would be great. Thanks!

— Stefano Verna Founder and CEO DatoCMS

--- original message --- On Thu, May 27 at 08:12 PM, @.***> Chadwick Maycumber wrote:

If I was too vague with my previous explanation I don't mind trying to add some clarification. This is the only thing keeping us from flipping our site from the newer gatsby image because it's breaking a custom navigation structure that we've set up in gatsby.

Let me know if I can provide some more insight.

You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe. --- end of original message ---

cmaycumber commented 3 years ago

There should be a "position" attribute for that. If you can share Gatsby version, dato plugin version, Dato project ID and a snippet of code reproducing the issue (the one that before worked and now it doesn't) that would be great. Thanks! — Stefano Verna Founder and CEO DatoCMS

Thanks for the reply, I'll try out the position attribute and see if I can get it working. Otherwise, I'll shoot you over all the above information.

cmaycumber commented 3 years ago

I ended up getting this working using the parent_id attribute. Thanks again for the response, sorry I missed this attribute the first time around.