Limit depth of tree-like collections

Ability to limit the number of depth levels editor can push pages to in tree structures.


Originally posted by webmaster@convincible.media

Hey @stefano.verna Thanks for suggesting this.

How are you managing tree collections? Eg

I am using gatsby. and I am wondering how I am meant to make gql queries when I can not anticipate how deep a tree structure a content editor may make

Thanks
Shan

@shannon if you don’t know how deep a tree you could fetch all the items and reconstruct the tree on your end.

You can fetch all the content like this:

{
  allDatoCmsTree {
    edges {
      node {
        id
        treeChildren {
          id
        }
        treeParent {
          id
        }
      }
    }
  }
}

and then reconstruct the tree using ids. Does that makes sense to you?