How to use the @sanity/base/initial-value-templates.getTemplateErrors 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 / components / SchemaErrorReporter.js View on Github external
render() {
    const problemGroups = schema._validation

    const groupsWithErrors = problemGroups.filter(group =>
      group.problems.some(problem => problem.severity === 'error')
    )

    if (groupsWithErrors.length > 0) {
      return 
    }

    const templateErrors = getTemplateErrors()
    if (templateErrors.length > 0) {
      return 
    }

    return this.props.children()
  }
}