Hello,
Using DatoCMS, I started implementing a block called LayoutBlock
that behaves exactly like flexbox:
The block has very similar properties and at last, the blocks
property which is a modular content allowing various type of other blocks including a LayoutBlock
.
I want to use it for a page model.
The page model consist of having an initial layout block and in the block section add other blocks as children.
Now, I face an issue when querying this page with GraphQL.
I’ve tried defining a fragment
fragment LayoutFieldsFragment on LayoutBlockRecord {
id
__typename
// various properties...
blocks {
...HeaderFieldsFragment
...ParapgraphFieldsFragment
...LayoutFieldsFragment **<= Issue here**
}
}
The problem is when I include the LayoutFieldsFragment
within itself, I get an error 500.
I would like to know if this is actually possible to achieve. If DatoCMS is flexible enough to nest the same block within itself.
Implementing this would give a very flexible way to the content editors when building pages and less coding for engineers.
I’ve read that maybe this is not possible given the GraphQL design and that I should specify a level of depth in LayoutFieldsFragment
. But I find this ugly.
Thank you in advance for your help!