How to use the @sanity/base/structure-builder.defaultInitialValueTemplateItems function in @sanity/base

To help you get started, we’ve selected a few @sanity/base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / @sanity / default-layout / src / util / getNewDocumentModalActions.js View on Github external
`Invalid "new document" configuration: "part:@sanity/base/new-document-structure" should return an array of items. Falling back to default structure.`
    )
    structure = S.defaultInitialValueTemplateItems()
  } else if (structure) {
    try {
      validateNewDocumentStructure(structure)
    } catch (err) {
      // eslint-disable-next-line no-console
      console.error(
        `Invalid "new document" configuration: ${err.message}. Falling back to default structure.`
      )
      structure = S.defaultInitialValueTemplateItems()
    }
  } else {
    // No structure defined, use default
    structure = S.defaultInitialValueTemplateItems()
  }

  return createModalActions(structure)
}