Studio

Tasks for Sanity Studio

Presence Cursors in Portable Text Editor, Comments and Tasks Out of Beta, and TypeGen Improvements

v3.40.0

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.

✨ Highlights

Presence cursors in the Portable Text Editor

Sanity Studio has always supported real-time collaboration, but you have yet to be able to see where others are working within the Portable Text Editor. By upgrading, you'll get a similar experience to Google Docs when editing block content.

Portable Text Editor with presence markers showing where users are working

This release also includes bug fixes for the Portable Text Editor:

  • The Portable Text Editor will now remove the invisible Stega-encoded characters if you copy-paste from a preview using Visual Editing
  • The cursor will not move out of viewpoint when deleting a character in PTE.
  • Creating an annotation at the bottom of a PTE will no longer scroll you to the top.
  • Fixes an issue where changing positions of items of an array within PTE would launch a cryptic error

Comments and Tasks are now out of beta

Comments and Tasks are now officially out of beta; hence, we have updated the configuration APIs. Both comments and tasks are enabled by default and for all document types.

Comments configuration migration

Configuration during beta:

// ./sanity.config.ts|js

export default defineConfig({
  // ... rest of config
  document: {
    unstable_comments: {
      enabled: false,
    },
  },
});

New configuration (remove unstable_):

// ./sanity.config.ts|js

export default defineConfig({
  // ... rest of config
  document: {
-   unstable_comments: {
+   comments: {
      enabled: false,
    },
  },
});

Tasks configuration migration

Configuration during beta:

// ./sanity.config.ts|js

export default defineConfig({
  // ... rest of config
  unstable_tasks: { enabled: false },
})

New configuration (remove unstable_):

// ./sanity.config.ts|js

export default defineConfig({
  // ... rest of config
- unstable_tasks: { enabled: false },
+ tasks: { enabled: false },
})

Sanity TypeGen improvements

Thanks for all the feedback about Sanity TypeGen so far! This release ships several improvements and bug fixes:

  • Sanity Typegen now supports count in GROQ projections
  • TypeGen code (sanity.types.ts) is now formatted when a project has a Prettier configuration
  • The TypeGen search path now includes src, app, and sanity folders by default
  • Various bug fixes for type generation
  • Fixes an issue where typegen command would fail on relative imports
  • Fixes a bug where we could not extract or validate schema when the sanity-plugin-mux-input plugin was installed.

Do continue to give us feedback in #typescript in the community!

🐛 Notable bugfixes

  • Fixes ambiguous aria-labels on some Status buttons
  • Fixes issue with inline text comments that would include an inline object.
  • Fixes toast message for document duplicate action

Tasks released for Sanity Studio + dependency upgrades for styled-components and @sanity/ui ++

v3.37.0

⚠️ This upgrade requires styled-components@6.1 and @sanity/ui@2

This release comes with version requirements for the following packages:

  • styled-components@6.1 (required for all Studio projects)
  • @sanity/ui@2 (optional)

If you're maintaining a plugin for Sanity Studio, we recommend upgrading its dependencies too.

styled-components (required)

We have seen incompatibility issues when styled-components@5 is used outside of the Vite configuration that ships with sanity, for example, when the Studio is embedded in a Next.js or Remix project.

Styled Components is a required dependency for Sanity Studio projects. By upgrading it, you can also delete the @types/styled-components and react-is dependencies that were required with styled-components@5:

# npm
npm install sanity@latest styled-components@^6.1
npm rm @types/styled-components react-is

# pnpm

pnpm install sanity@latest styled-components@^6.1
pnpm rm @types/styled-components react-is

# yarn

yarn add sanity@latest styled-components@^6.1
yarn rm @types/styled-components react-is

Note: if you have local customizations in your Sanity Studio that are using styled-components you may need to make some minor adjustments to the customization code. For more details, please consult the styled-components migration guide.

@sanity/ui

Studio projects that use @sanity/ui for customizations and have it as a dependency in package.json need to upgrade to @sanity/ui@2:

# npm
npm install "@sanity/ui@^2"

# pnpm
pnpm install "@sanity/ui@^2"

# yarn
yarn add "@sanity/ui@^2"

✨ Highlights

Tasks (Beta)

Sanity Studio now ships with Tasks. You can now:

  • Target tasks for specific documents
  • Assigned tasks to Studio members
  • Comment on tasks, and use @-mentions
  • Resolve tasks
Tasks for Sanity Studio

Tasks ships enabled by default. If you want to disable tasks in your Studio, you can do so with this configuration:

export default defineConfig({
  // ... rest of config
	unstable_tasks: { enabled: false },
})

Learn more about Tasks in the documentation:

Other features

  • Resolves "Masquerading as CJS and ESM" type errors
  • Adds ESM with .mjs exports for full support of Node.js' native ESM mode while still offering support for .esm.js exports for legacy bundlers
  • Adds missing sideEffects: false conditions to package.json files, improving tree-shaking and reducing bundle sizes for embedded Sanity Studio projects
  • Simplifies the Shopify schema starter template

🐛 Notable bugfixes

  • Fixes a bug where wrongly formatted configuration would be inserted into tsconfig.json when sanity init was run inside of a Next.js project
  • Fixes an issue where importing .scss or .sass files from the studio configuration or a descendant file would cause certain CLI commands to crash
  • Improves error message when extracted schema (from sanity schema extract) could not be found when running sanity typegen generate
  • Fixes an issue where the CLI might suggest deprecated Sanity v2 commands if you mistype a command name
  • Makes the current field on slugs required when used with the --enforce-required-fields flag in sanity typegen contexts
  • Fixes a bug where running npx sanity init in a Next.js project would break the tsconfig.json configuration