The logic is a bit flawed/messy for passing collection/global options around.
The flow:
source-nodes.ts loops through collections and globals abd calls functions in:
fetch.ts which will use options from the source-nodes calls to determine values for gatsbyNodeType and gatsbyImageCdn which it passes to:
format-entity which does some pre-processing before returning data back to source-nodes in a form ready for building Gatsby nodes.
As a result, when the data comes back (using promises) to source-nodes, the data itself is unaware of the original query/collection options. We've gotten around this limitation by adding the gatsbyNodeType and gatsbyImageCdn fields to the node itself, but modifying the node feels obtuse.
Refactor the logic to make this process cleaner and easier to understand.
The logic is a bit flawed/messy for passing collection/global options around.
The flow:
source-nodes.ts
loops through collections and globals abd calls functions in:fetch.ts
which will use options from thesource-nodes
calls to determine values forgatsbyNodeType
andgatsbyImageCdn
which it passes to:format-entity
which does some pre-processing before returning data back tosource-nodes
in a form ready for building Gatsby nodes.As a result, when the data comes back (using promises) to
source-nodes
, the data itself is unaware of the original query/collection options. We've gotten around this limitation by adding thegatsbyNodeType
andgatsbyImageCdn
fields to the node itself, but modifying the node feels obtuse.Refactor the logic to make this process cleaner and easier to understand.