Schema
New schema validate command, improvements to scheduled drafts, and multiple fixes
v4.20.0
✨ Highlights
Deprecating React 18
React 19 was released December 5, 2024, and the Sanity Studio has supported it since the early days, while still preserving compatibility with React 18. Now, as we approach the one year mark of the React 19 release, its time to leave React 18 behind so that the Studio can start adopting React 19-only features for more efficient data fetching and rendering patterns. As of this release, React 18 is officially marked as deprecated and in the coming weeks we will release a new major version (v5) which drops support for React v18 entirely.
To prepare for this change we recommend that all existing Studios are upgraded to the latest React 19.x. For plugin developers, we recommend that you test and verify that your plugin is tested compatible with React 19, and you can also start preparing for the Sanity v5 release where React 19.2 is the new baseline. Also make sure to mark it as compatible with v5 by including Sanity v5 in the allowed peerDependency range, e.g.: "sanity": "^3.0.0 || ^4.0.0 || ^5.0.0-0" (note the trailing -0 to make it compatible with prereleases of v5).
Sanity schema validate
This update adds a new flag to the schema validate command. sanity schema validate --debug-metafile-path <path> outputs a file with information about the size of the serialized schema. The file follows ESBuild's metafile format and can be analyzed through https://esbuild.github.io/analyze/.
This visualization can help identify large parts of a schema that rely too heavily on inlined types or fields, rather than named, reusable, types.

Deleting scheduled drafts allows for copying contents back to draft
Deleting scheduled drafts now gives you the option to copy the content of the scheduled version to a draft version of the document.

New to scheduled drafts? Check out the user guide.
Allow createGlobalStyle to work with auto updating studios
Fixes an issue where createGlobalStyle from styled-components doesn't work if the Studio is deployed with autoUpdates: true. Usually this issue would manifest itself in some UI text using Times New Roman instead of Inter, and missing browser scrollbar styling.
If you're affected by this issue you'll need to run a new sanity deploy after updating to sanity@latest, you might as well use our styled-components fork while at it and give your studio a nice performance boost.
If you're already using @sanity/styled-components instead of styled-components then you're not affected by this issue.
Additional improvements
- Makes Unpublish the primary action for Published documents.
- The delete confirmation dialog now includes information about the versions of the document that will be deleted by it, providing extra clarity for users. This action will only be available if a published version of the document exists.
🐛 Notable bugfixes
- Fixes an issue where Presentation Tool would construct an invalid URL on refresh if the URL in the address bar was absolute.
- Fixes a regression in
v4.19where schema errors were not formatted properly and difficult to understand. - Fixes an error in where focusing on image inputs inside dialogs would unexpectedly close it.
- Fixes a bug where nested validation rules could prohibit selecting an asset from the Media Library.
- Fixes a bug in where disabling comments, through
__internal_comments: undefinedin portable text was not taking effect in portable text inline comments. - Fixes several issues with the
datetimeinput.- Fixes inconsistent second and milliseconds in the time input initial value.
- Restore support for time step in the time input.
- Fixes an issue in where in some cases the releases tool could crash when doing changes in the time input.
- Use the tool title for
document.titleif present, instead of defaulting to tool name - Fixes an issue that prevent React 19 studios from being able to use the
@sanity/css-in-jsdrop-in replacement forstyled-components. While@sanity/styled-componentsalso works,@sanity/css-in-jsuses React 19 features to be even faster. - Fixes an issue in where delete operation wouldn't work if you had version documents.
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.
Introduction of Sanity TypeGen and Tasks Beta
v3.36.0
Installation and upgrading
To initiate a new Studio without installing the CLI globally:
npm create sanity@latestpnpm create sanity@latestyarn create sanity@latestbun create sanity@latestTo upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latestpnpm add sanity@latestyarn add sanity@latestbun add sanity@latestSanity TypeGen (beta): Generate types for your schema and GROQ queries
This release comes with Sanity TypeGen, the new tooling in the Sanity CLI that enables extracting the schema into a static representation (schema.json) and to generate TypeScript type definition for it, as well as for GROQ query results.
You can learn more about Sanity TypeGen:
- Blog post: Of course, you should be able to type your content quickly!
- Documentation
- New course on Sanity Learn
If you try out Sanity TypeGen, do let us know how it went in the #typescript channel in the Sanity community or to your customer success team.
Tasks (beta): Delegate work within Sanity Studio
This update also includes the beta of Tasks for Sanity Studio. It's a way to assign tasks related to documents, delegate them to team members, and track their status across the project.

If you wish to disable tasks, you can do so by adding the following to sanity.config.ts:
export default defineConfig({
…restOfConfig,
unstable_tasks: {
enabled: false,
},
})Documentation for Tasks is in the works and will be announced when ready.
🐛 Notable bugfixes
- Fixes a bug where all fields got marked as non-optional when extracting schema with
--enforce-required-fields. - Fixes a bug where Vision would insert a new line on cmd-return.
Problems with styled-components@5?
If you encounter an error such as TypeError: Cannot read properties of undefined (reading 'div'), please make sure your Studio doesn't depend on styled-components@5. Updating any such dependencies to styled-components@6 should resolve the error:
npm install styled-components@latestpnpm add styled-components@latestyarn add styled-components@latestbun add styled-components@latestNew CLI Commands, Content Migration Tooling, Schema Validation, and Enhanced Localization & Validation Support
v3.27.0
Installation and upgrading
To initiate a new Sanity Studio without installing the CLI globally:
npm create sanity@latestpnpm create sanity@latestyarn create sanity@latestbun create sanity@latestTo upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latestpnpm add sanity@latestyarn add sanity@latestbun add sanity@latest✨ Highlights
New CLI command sanity migration create|list|run
You can now create, list, and run content migrations from the Sanity CLI. The new tooling lets you scaffold content migrations as code and run them in dry and production mode. It also introduces a new API for defining content migration with helper functions (defineMigration()).
You can explore the documentation for schema and content migrations; or learn more by running the following CLI commands in a Sanity Studio project folder:
sanity migration --helpYou can run sanity migration create to explore our new content migration templates.
New CLI command: sanity schema validate
You can now validate a Sanity Studio schema with the CLI command sanity schema validate. Among other things, it will identify problems with your schema-type definitions. This tooling can be useful for running in CI/CD pipelines or debugging your schema configuration.
Learn more by running:
sanity schema validate ---helpOther features
- Adds Studio UI localization support to the comments plugin
- Adds support for validating dataset import and export files with
sanity documents validate - Adds
intentUrlinjsonandndjsonformats forsanity documents validate