Stable singletons API and fewer real-time connections

Published: November 17, 2026

v6.24.0

Validation outside the studio now reports errors as errors, so a sanity documents validate check that passed before can fail after you upgrade. This release also makes the first-class singletons API stable, and Sanity Studio opens fewer real-time connections when many documents are open.

Action required

  • Who's affected: Projects that validate documents outside the studio, with validateDocument from @sanity/validation or with sanity documents validate, for example in CI.
  • What to do: Run validation after you upgrade and fix the errors it reports. Required fields, slug uniqueness, and rules marked .error() on slug, image, file, object, and document fields, and rules set with Rule.fields(), were reported as warnings. They're now reported as errors, the same as in the studio, and sanity documents validate --level error no longer hides them.
  • By when: When you upgrade to this release. If you do nothing, validation runs that passed before can fail.

New features

Singletons API is stable

The first-class singletons API, introduced in beta in Sanity Studio 6.16.0, is now stable. You can use document.singletons and defineSingleton without the beta caveat.

Singleton definitions also accept a new allowNonSingletonDocuments option. By default, registering a singleton over a schema type removes that type from "create new document" menus and the default structure. Set allowNonSingletonDocuments: true when editors still need to create ordinary documents of that type alongside the singleton.

document: {
  singletons: [
    'settings',
    {documentId: 'spring', schemaType: 'campaign', allowNonSingletonDocuments: true},
    {documentId: 'summer', schemaType: 'campaign', allowNonSingletonDocuments: true},
  ],
}

For setup and examples, see Singleton documents in the Structure Builder cheat sheet.

Improvements

  • Real-time connections: Comments and Tasks share one connection to the comments dataset, instead of one for each open document and task.
  • Real-time connections: The releases list, content variants, and variant document counts reuse the listener the studio already keeps open for document previews.
  • Real-time connections: After you switch workspaces, the previous workspace's release and variant listeners close within a few seconds. Before, they stayed open until you closed the page.
  • Presentation Tool: When your role can't open the preview with draft content, the tool explains why. For example, a Viewer on a project with preview sharing turned off sees their role and how to get access, and can continue to the published preview. Previously they saw "Unable to connect" and a button that did nothing.
  • Presentation Tool: The document pane always shows a breadcrumb. When you open a document other than the page's main document, for example by clicking a referenced document in the preview, the breadcrumb links back to the main document.
  • Navbar: The studio navbar styling matches the Sanity Dashboard navigation.
  • Vision Tool: The editors no longer show the line-number gutter as a separate gray panel. The gutter shares the editor's background, separated by a subtle border, and the current line number is highlighted with the text color instead of a background.
  • Dashboard apps: The studio loads Dashboard apps from their new addresses.
  • TypeScript: DocumentPairPermissionsListener is exported from sanity. Use it to type the listener option ('document' or 'global') of useValidationStatus, useSetImmediateValidation, and documentStore.pair.validation.

Fixes

  • Presentation Tool: Fixes a crash in the document pane (React error #301, "Too many re-renders") when a field action's useAction hook returned a new onAction function on every render. These actions no longer need manual memoization.
  • Portable Text Editor: Fixes a crash ("Maximum update depth exceeded") when opening a document with a Portable Text field whose block or inline object types use a lazily loaded icon, such as an icon from the icons map in @sanity/icons.
  • Portable Text Editor: Bold text is clearly heavier than the surrounding text, including in dark mode. Headings that are already bold stay bold when you apply the strong decorator.
  • Arrays: Array items that sometimes couldn't be reordered by drag and drop now move as expected. The console showed "Neither the item you are moving nor the item you are moving to have a key."
  • Forms: The collapse control on an object or fieldset no longer covers the start of its label.
  • Forms: Hidden fields no longer show a warning about an invalid value. For example, an array hidden with hidden no longer shows the "Missing keys" alert when its items were created through the API without a _key.
  • Comments: Comments update right away when you switch a document's release.
  • History: Edits made close together are grouped into the same "Edited" entry, no matter when you opened the document. Previously, two people (or two panes) viewing the same document could see the same edits grouped differently.
  • Releases: Document counts and "updated" times on the Releases overview update live again when documents in a release change.
  • Navbar: The Variants and Releases menus no longer open empty in studios with variants enabled.
  • Menus: Menu items stay readable when hovered or selected with the keyboard. This affected the "Copy to release" submenu, agent proposed changes in the perspective menu, the Compare versions picker, the published event menu in History, and the Schedules validation list.
  • Help menu: The status line under "Sanity Studio" stays readable when you hover or focus that row.
  • Embedded studios: An embedded studio scrolls on small screens when tasks.enabled is false.
  • Document header: Firefox no longer shows a horizontal scrollbar under the version chips when they don't fit.
  • Edge runtimes: You can import sanity at module scope in runtimes that forbid random values during module evaluation, such as Cloudflare Workers.
  • Validation: uri() rejects URLs whose host percent-decodes to a forbidden character, such as https://07480%20589%20950/, in every browser. Previously Chrome accepted them in the studio while sanity documents validate rejected them.
  • CLI: sanity init and sanity skills install no longer crash during agent skills setup with ERR_PACKAGE_PATH_NOT_EXPORTED.
  • CLI: sanity build warns instead of failing when the module server version check is unavailable.

Deprecations

  • Key-value store: useKeyValueStore, createKeyValueStore, KeyValueStore, and KeyValueStoreValue are deprecated and will be removed in Sanity Studio v7. They keep working until then. There's no public replacement yet. The studio's own replacement, useStudioPreference, is exported only from sanity/_dangerously_use_private_internals_that_do_not_follow_semver, which can change in any release.
  • Portable Text input: The hotkeys, onCopy, and onPaste props of PortableTextInput are deprecated, following their deprecation in @portabletext/editor. They keep working. Register keyboard.keydown, clipboard.copy, or clipboard.paste Behaviors instead, using BehaviorPlugin from @portabletext/editor/plugins rendered in form.components.portableText.plugins.
Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme