Join us live Sept. 27 – How Sanity and Vercel powered Morning Brew's transformation –>

Structure: Item returned no child

In most cases, you will want to return a child when a list item is clicked. If you are receiving this warning, your list has probably not defined a child/child resolver, or the child resolver is returning undefined.

You usually want to specify a child for an item:

S.listItem()
  .title('George R. R. Martin')
.child(
S.documentList() .title('GRRM books') .filter('_type == "book" && author._ref == "grrm"')
)

If you intentionally don't want to return any child, define the child or child resolver to be null instead of undefined:

S.documentListItem()
  .id('grrm')
  .title('George R. R. Martin')
  .schemaType('author')
.child(null)

Was this article helpful?