Documents
Performance improvements in development mode and enhanced document validation in CLI
v3.57.0
✨ Highlights
Significant rendering perf. improvements (up to x10) in dev mode
This change enables styled-components
"speedy mode" in sanity dev
, improving developer mode performance. This change impacts only development builds (sanity dev
) – production builds (sanity build
or sanity start
) remain unaffected since "speedy mode" has always been enabled in production.
Developers embedding Sanity Studio in other frameworks like Next.js or Remix need to adjust their own build tooling to declare the SC_DISABLE_SPEEDY
flag to achieve the same performance benefits. For example, Next.js users can add this snippet to their next.config.{js,mjs,ts}
file:
export default {
env: {
SC_DISABLE_SPEEDY: 'false' // makes styled-components as fast in dev mode as it is in production mode
}
}
For Safari users, while they will still be able to inspect and see CSS rules coming from styled-components
, these will now be read-only in the DevTools inspector. The performance benefits from enabling "speedy mode" in development mode are significant for Safari users and outweigh the convenience of being able to edit these rules directly in the inspector. With Hot Module Reload, developers can still quickly make changes to their source code, and the new styles will apply immediately.
Enabling "speedy mode" offers a faster development experience across the board. Developers using Safari for testing purposes can still verify the functionality of the studio, and for more detailed CSS editing, they can switch to Chrome, Firefox, or other Chromium-based browsers like Arc or Brave.
It's still possible to restore the old behaviour of disabling speedy in dev mode in userland with a custom sanity.cli.ts
override:
import {defineCliConfig} from 'sanity/cli'
import {type UserConfig} from 'vite'
export default defineCliConfig({
vite(viteConfig: UserConfig): UserConfig {
return {
...viteConfig,
define: {
...viteConfig.define,
// `sanity dev` enables speedy in both development and production,
// this line restores the default `styled-components` behaviour of only enabling it in production
'process.env.SC_DISABLE_SPEEDY': JSON.stringify(process.env.NODE_ENV !== 'production'),
},
}
},
})
add --max-fetch-concurrency
to prevent stalled validators
This update addresses an issue where the sanity documents validate
CLI command could time out when validating documents with complex custom validation rules. The changes include:
- Increased default maximum fetch concurrency from 10 to 25, which should resolve most timeout issues.
- Added a new CLI flag
--max-fetch-concurrency
to allow users to adjust the maximum number of concurrentclient.fetch
requests during validation. - Made the default maximum custom validation concurrency explicit and configurable.
Usage:
sanity documents validate --max-fetch-concurrency <number>
These changes should improve the performance and reliability of document validation for projects with complex custom validation rules. Users experiencing timeouts during validation should try increasing the --max-fetch-concurrency
value if issues persist with the new default.
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.
New 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@latest
To upgrade a Sanity Studio, run this command in its folder:
npm install 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 --help
You 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 ---help
Other features
- Adds Studio UI localization support to the comments plugin
- Adds support for validating dataset import and export files with
sanity documents validate
- Adds
intentUrl
injson
andndjson
formats forsanity documents validate
Sanity Studio Updates: New CLI Command, Improved Copy-Paste Experience, UI/UX Enhancements, and Bug Fixes
v3.25.0
Installation and upgrading
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade Sanity Studio, run this command in its folder:
npm install sanity@latest
✨ Highlights
Beta: Check the validation status of all documents with the CLI
The new sanity documents validate
command is now available! It runs all documents in a dataset against your project's schema in the terminal. It uses a mocked browser environment to validate all documents locally, perfect for ensuring data integrity.
Note: This feature is currently in beta, so it might not run correctly for all projects. We encourage users to report any issues encountered to help us improve it.
Improved copy-paste experience from Google Docs and Notion
The Studio now preserves formatting more reliably when content is pasted from Google Docs in Safari, and no longer incorrectly applies underline decorators to pasted links. Additionally, the Studio now preserves formatting more reliably when content is copied from a single block in Notion.
User interface and experience updates
- Root page link: The workspace icon now consistently serves as a direct link to the 'root' page (the first configured tool), streamlining navigation.
- Improved Workspace Switcher: A new tooltip feature has been added to the workspace switcher for better clarity.
- Simplified Tool Menu: The tool menu will now be hidden when only one tool is installed, reducing clutter.
- Layout stability: We've resolved an issue with long workspace titles disrupting the navbar layout. Titles now truncate with ellipses to maintain a clean appearance.
- Localized tooltip text: The 'open menu' button tooltip text has been localized and is now more accessible on smaller screens.
- Intuitive icons: The help and resources button now features the correct icon, making it more intuitive and consistent with previous versions.
- PTE improvements: Ensures that clicking to edit in presentation mode correctly focuses the relevant block, improving the editing workflow.
🐛 Notable bugfixes
- Fixes a bug where logging out didn't invalidate the cookieless auth token.
- Fixes an issue in the Portable Text Editor where the 'Empty' placeholder placement was off.
- Fixes an issue where array item focus rings were cropped, ensuring they're now displayed in full.
- Fixes a bug where the workspace switcher tooltip wasn't displaying correctly.