Sanity Studio v5.11.0: Conditional multi-schema references and bug fixes

This release improves reference field creation filtering with dynamic options, fixes document publishing issues, and enhances the display of nested content and release titles.

Conditional multi-schema references

It is now possible to apply dynamic document based filtering to the acceptable schema types from which to create a new reference field. When a document contains a reference field with a to that includes multiple schema types, by defining an options.creationTypeFilter callback, the available schemas when selecting Create can be restricted.

If creationTypeFilter returns [] then the create button will be hidden from the reference field. This is identical behavior to using options.disableNew: true

defineField({
name: 'participant',
title: 'Individual or team participant,
type: 'reference',
to: [{type: 'individual'}, {type: 'team'}],
options: {
creationTypeFilter: ({document}, toTypes) => {
if (document.participantType === 'individual') {
return toTypes.filter((t) => t.type === 'individual')
}
if (document.participantType === 'team') {
return toTypes.filter((t) => t.type === 'team')
}
return toTypes
},
},
})

🐛 Notable bugfixes and improvements

Fixes an issue causing document action to hang in Validating document…state when attempting to publish versions created by Content Agent

Fixes an issue preventing the correct field being shown when following a stega overlay that maps to a field, inside a non-default group, inside an object array member

Enhanced Object Dialog: instead of showing “Mark Definitions” (from markDefs) on some PTE nested objects, instead shows the content in the PTE’s preview

Improved visibility of releases with long release titles

Fixes an issue where published documents would show a publish action