When querying for a block that resides within another object i.e. not at root level there doesn't seem to be a way to get any useful information out of it.
Example query:
query MyQuery {
sanityPage {
modules {
... on SanityRichText {
_key
_type
blocks {
style
}
}
}
}
}
Most of the fields under "blocks" are null. The only way I've been able to get the content I need out of this particular example is by using _rawModules at the root level. This isn't ideal since I'm already querying for each type of module using inline fragments and including the raw data is just doubling up on that and adding extra data I don't want.
The official GraphQL API seems to allow outputting raw json at a nested level, I've confirmed this via the playground with the following query:
query {
allPages {
modules {
... on RichText {
blocksRaw
}
}
}
}
Is it possible to implement this same behaviour in the Gatsby plugin?
When querying for a block that resides within another object i.e. not at root level there doesn't seem to be a way to get any useful information out of it.
Example query:
Most of the fields under "blocks" are null. The only way I've been able to get the content I need out of this particular example is by using
_rawModulesat the root level. This isn't ideal since I'm already querying for each type of module using inline fragments and including the raw data is just doubling up on that and adding extra data I don't want.The official GraphQL API seems to allow outputting raw json at a nested level, I've confirmed this via the playground with the following query:
Is it possible to implement this same behaviour in the Gatsby plugin?