Specifications

Function handler reference

Allow draft model to be switched off, local context for functions, multiple datasets in Vision and portable text improvements

v3.96.0

✨ Highlights

Allow draft model to be switched off

The draft model can now be switched off by setting the document.drafts.enabled configuration option to false. When the draft model is switched off, drafts will not appear in Studio, and users may only create or edit documents inside a release (unless they are live-edit documents).

If the draft model is switched off while the dataset contains drafts, a banner will be displayed when opening the document in Studio allowing you to compare the draft content, and publish or discard the obsolete draft. This makes it possible to safely switch off the draft model without running a bulk document migration.

The draft model is switched on by default.

Vision datasets config option

Vision now supports datasets config option, allowing users to configure which datasets to display in the tool

a screenshot of a web page that shows vision app

Improvements to Portable Text Editor

The Portable text Editor now allows you to open referenced documents from annotation popups.

List counts are now improved and should work more predictably. For example, the correct list count for numbered list items outdented to the 10th level will now display correctly.

Functions context now indicates local invocation

Functions run locally now receive a context.local property set to true in both the sanity functions test and sanity functions dev commands. This allows you to run code specific to local invocations. In production, context.local is undefined. See the Functions handler reference for more context properties.

Function dependency management now supports flexible app structures

Functions will now find dependencies at the project-level, or the function-level depending on the location of your package.json manifests. If a function contains a package.json and dependencies in the individual function folder, it will use them during testing and deployment. If a function lacks local dependencies, it will use the package.json located alongside the blueprints configuration file (sanity.blueprint.ts).

You can learn more in the function dependency management guide.

Coming soon: v4 drops Node.js 18 support

On July 15th, the sanity package is moving from v3 to v4. The only breaking change is that it now requires Node.js 20, where it previously required Node.js 18. Learn more about why we're making this change and what it means for your apps.

🐛 Notable bugfixes

  • Fixes issue where delete changes were not being displayed correctly in Review Changes.
  • Restores exports removed in 3.95.0 and adds deprecation warnings to exports related to scheduled-publishing from the sanity package.
  • Fixes an issue where it was possible to create a new document version when the Content Releases feature was turned off for a studio.


Install or upgrade Sanity Studio

To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.

If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.

Types included for Functions and additional bugfixes and improvements

v3.89.0

✨ Highlights

TypeScript types for Functions

Functions now have official types available. When selecting "TypeScript" after running sanity blueprints add function, you'll be prompted if you'd like to include the type package and handler.

You can also manually install types by adding the @sanity/functions package to your function. See the Functions quick start or function handler reference for usage details.

🐛 Notable bugfixes

  • Adds a notification for when a media library cannot be found (#9387) (9a2039cbd3)
  • Removes linting configs from app templates (#9421) (3ae5104dc2)
  • Adds fix for hanging requests (#9433) (e57b96c9dc)
  • Updates React Compiler dependencies 🤖 ✨ (#9440) (7ac692662b)
  • Updates dependency @sanity/client to ^7.2.2 (#9448) (7e52ce2039)
  • Improves connection error handling (#5893) (974be5178e)

Install or upgrade Sanity Studio

To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.