Sanity Studio v5.9.0: Fix for Presentation perspective bug and improved context awareness for schema validations
This release adds validation context for hidden fields, introduces a rule.skip() method, enables automatic schema extraction during development, allows documents to open with multiple split-pane views by default, and fixes several bugs including issues with scheduled drafts, timezone changes, text field updates, published document status, and the presentation tool.
Adds new context to the validation property in the schema that includes if the field is hidden (context.hidden) for any reason (be it by the hidden condition in itself or any ancestor.)
Adds new rule method rule.skip() which will skip a validation completely.
import {defineField} from 'sanity'
export const titleField = defineField({
name: 'title',
title: 'Title',
type: 'string',
validation: (rule, context) => (context?.hidden ? rule.skip() : rule.required().min(5)),
})
Schema extraction can now be performed as part of the dev and build commands. No longer necessary to run it manually.
Configure it in sanity.cli.ts as shown below.
import {defineConfig} from 'sanity'
defineConfig({
// ... rest of config
schemaExtraction: {
enabled: true
}
})
defaultPanes option to documentsNew Structure Builder API: S.document().defaultPanes(['viewId1', 'viewId2'])
Allows configuring documents to open with multiple views displayed as split panes by default. Content editors no longer need to manually set up side-by-side editing for documents where admins have configured a default split view.
// In defaultDocumentNode resolver
export const defaultDocumentNode: DefaultDocumentNodeResolver = (S, {schemaType}) => {
if (schemaType === 'article') {
return S.document()
.views([
S.view.form().id('editor'),
S.view.component(LivePreview).id('preview').title('Preview'),
S.view.component(JSONView).id('json').title('JSON')
])
.defaultPanes(['editor', 'preview']) // Form + Preview side-by-side
}
return S.document()
}
text to end up in a nested value object on the object itself.TypeError: Cannot read properties of undefined (reading 'startsWith') wasn’t very helpful, nor actionable. Good riddance! ⚡of property contains multiple primitive types that resolve to the same JSON type (e.g., both string and text). This helps developers catch configuration issues where Sanity cannot distinguish between array members at runtime.Fetched April 11, 2026