Changelog

Improvements and bugfixes

Studio v3.8.1

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes a regression from v3.8.0 where annotations could not be edited in Safari
  • Fixes an issue with duplicate keys when pasting empty lines into an empty Portable Text input


Version released on: March 29, 2023

Improvements and bugfixes

Studio v3.8.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

Improved global create menu

The global create menu has been updated with alphabetically sorted options and a search field, providing a more convenient way to find a desired document. The menu has also been redesigned to appear in a popover instead of a full screen dialog for improved UX and less context switching.

🐛 Notable bugfixes

  • Fixes a recent regression in the Portable Text Editor where pasting content into an empty editor would cause an error
  • Fixes content overflow bug for query results in Vision and adds scroll bars to the result pane
  • Fixes issue where focus was not being returned to the editor after changing the style of a Portable Text block
  • Improves performance and issues related to validation in the Portable Text Editor

Version released on: March 28, 2023

Improvements and bugfixes

Studio v3.7.1

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue where an array field’s value is not set to undefined when the last item is removed
  • Fixes hydration mismatch issues
  • Fixes an issue where preview panes are not preserved on smaller screens
  • Fixes an issue where the studio may crash when accessing history changes with reduced permissions

Version released on: March 21, 2023

Bugfixes and improvements

Studio v2.36.0

⚠️ THIS IS A MAINTENANCE RELEASE OF A PREVIOUS MAJOR VERSION OF SANITY

We recommend updating to Sanity Studio v3 which provides exceptional flexibility and an unparalleled developer experience. The core packages for Sanity Studio v2 will only receive critical bug fixes until Dec 7th, 2023

Please head over to the documentation for Sanity Studio v3 to learn more.

You can find migration guides from Studio v2 here.

Installation and upgrading

Upgrade the v2 version of the Command Line Interface (CLI) with:

npm install --global @sanity/cli@v2

Upgrade Sanity Studio with:

sanity upgrade

Version released on: March 15, 2023

Bugfixes and improvements

Studio v3.7.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

  • Adds getClient() method to reference filter context

🐛 Notable bugfixes

  • Invalid references can now be removed from array inputs
  • Validation error will now appear when missing a _ref in array of items
  • Removes convert to reference button when converting array of references to singular reference
  • patch.execute() now reflects that the second argument is optional

Version released on: March 15, 2023

Bugfixes and improvements

Studio v2.35.7

⚠️ THIS IS A MAINTENANCE RELEASE OF A PREVIOUS MAJOR VERSION OF SANITY

We recommend updating to Sanity Studio v3 which provides exceptional flexibility and an unparalleled developer experience. The core packages for Sanity Studio v2 will only receive critical bug fixes until Dec 7th, 2023

Please head over to the documentation for Sanity Studio v3 to learn more.

You can find migration guides from Studio v2 here.

Installation and upgrading

Upgrade the v2 version of the Command Line Interface (CLI) with:

npm install --global @sanity/cli@v2

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes issue where clicking a document reference while still loading would result in an invalid link and cause the studio to crash
  • Fixes an issue that might cause the studio to crash when trying to view history in a dataset copied with the --skip-history flag

Version released on: March 08, 2023

Bugfixes and improvements

Studio v3.6.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • General search performance improvements on larger studios (containing thousands of fields)
  • Desk Structure is now able to auto-generate IDs from non-ascii source values (for instance cyrillic characters)
  • Allows fractional section of a number to have leading zeros (thanks @pauloborges!)
  • Fixes studio authentication when using a custom API hostname
  • Makes schemas in Shopify online storefront template compatible with GraphQL deployments
  • Fixes an issue of document type icons not showing up in array fields
  • Fixes a bug where opening a reference field dropdown would not trigger a defined filtering function
  • Restores functionality of the "Open in new tab" function for arrays of references
  • Fixes issue where clicking a document reference while still loading would result in an invalid link and cause the studio to crash
  • Fixes several issues that might occur when dealing with duplicate document IDs across workspaces
  • Fixes an issue that might cause the studio to crash when trying to view history in a dataset copied with the --skip-history flag

Version released on: March 08, 2023

Improvements and bugfixes

Webhooks v2023-03-07

  • The set of origin IP addresses for webhook calls are now published in the documentation and always kept up-to-date. See more details on the documentation page here.
  • Webhook calls now include by default Sanity-specific headers with additional metadata useful for debugging. See more details on the documentation page here.

Version released on: March 07, 2023

Improvements and bugfixes

Mutation API v2023-03-07

  • Document deletion mutations can now fully purge the history of a document, specially important for privacy and compliance requirements. See more information in the documentation page here.

Version released on: March 07, 2023

Bugfixes

Studio v3.5.1

Installation and upgrading Comment

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue where the accept option for file and image schema types would not be respected by the image and file picker, only new uploads
  • Fixes dialog closing behavior in the studio to be more consistent
  • Improves readability of date and datetime diffs in the review changes panel
  • Fixes an issue where the first focusable element in a document was not focused when opening the document
  • Fixes an issue where form dialogs were not closing as esxpected when navigating to a new document
  • Fixes an issue where the selected sort option in the document list was not highlighted in the UI
  • Fixes an issue where the correct default fieldgroup was not set in an array of objects
  • Fixes an issue where opening a browser from the CLI tool on Windows might cause the login process to crash
  • Adds missing options in mobile sidebar menu
  • Fixes a regression from v3.4.0 in the Portable Text Editor that could corrupt text when typing fast and toggling text decorators (I.e. bold or italic) while typing
  • Fixes a regression from v3.4.0 in the Portable Text Editor where it sometimes would error when toggling between different versions in the History View

Version released on: March 01, 2023

Improved handling of environment variables

Studio v3.5.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

Improved .env/environment variable handling

Over the past few releases we have been addressing some inconsistencies in how environment variables can be used. This release greatly improves how "dotenv" (.env) files are handled. To summarize the new behavior of environment variables and dotenv files from this release (v3.5.0) and onward:

  • All environment variables with the SANITY_STUDIO_ prefix is exposed to the bundle, and is available through process.env.SANITY_STUDIO_.... While they are theoretically also available under import.meta.env, it is not recommended to use them this way since it’s behavior specific to Vite, and thus not available under the same location in Node.js and other environments.
  • We now load both .env, .env.local, .env.<mode> and .env.<mode>.local files from the studio root folder. This is consistent with Vite’s behavior.
  • The .env files are loaded in the following order:
    • .env
    • .env.local
    • .env.<mode>
    • .env.<mode>.local
  • By default, sanity build and sanity deploy will use the production mode, while all other commands will default to the development mode.
    • Setting NODE_ENV to production will set the mode to production, but setting it to other values (such as test) will not change the mode.
    • To use a custom mode, you can set the SANITY_ACTIVE_ENV environment variable.
    • Both NODE_ENV and SANITY_ACTIVE_ENV must be set as a regular shell environment variable, not in .env files, since knowing which .env file to load is based on it.
  • Environment variables set in the shell will override variables set in the .env files.
  • The environment variables are loaded into both the browser bundle environment, and the CLI context. In other words, running scripts through sanity exec will have access to the same environment variables as the Studio bundle, and you can use environment variables in your sanity.cli.ts/sanity.config.ts files. Make sure you use process.env and not import.meta.env for cross-environment support.

Note that we encourage you to use environment variables sparingly, and define them in a single location instead of spreading them throughout the code base. This makes it easier to see which environment variables are in use, and allows you to easier transition between different environments should you need to. For instance, one might create a src/environment.ts file which re-exports the environment variables:

export const myCompanyInternalApiUrl = process.env.SANITY_STUDIO_MY_COMPANY_INTERNAL_API_URL
export const someOtherVariable = process.env.SANITY_STUDIO_SOME_OTHER_VARIABLE

Programmatic usage

Should you want to reuse the environment variable handling in other contexts (your own scripts, or using a different bundler etc), you can import and utilize the new getStudioEnvironmentVariables() method from sanity/cli:

import {getStudioEnvironmentVariables} from 'sanity/cli'

console.log(getStudioEnvironmentVariables())
// {SANITY_STUDIO_SOME_VAR: 'yourVariableValue'}

Note that .env files are not loaded by default when using this method. To do so, pass an envFile option:

import {getStudioEnvironmentVariables} from 'sanity/cli'

console.log(
  getStudioEnvironmentVariables({
    envFile: {
      mode: 'production',
      envDir: '/path/to/some-dotenv-root'
    }
  })
)

🐛 Notable bugfixes

  • Fixes an issue where generation 1 GraphQL APIs would have changed pluralization rules for types ending with a number.

Version released on: February 21, 2023

Bugfixes

Studio v3.4.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

Notable changes

  • The studio has been upgraded to use @sanity/client v5, which boasts full Node.js ESM runtime support, a smaller footprint and much more

🐛 Notable bugfixes

  • Fixed a bug that could lead to duplication of a single block in the Portable Text Editor

Version released on: February 15, 2023

Improvements and bugfixes

Studio v3.3.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

A custom API hostname can now be configured for the studio through the apiHost configuration parameter. Note that the configured API host must behave the same as Sanity's API. This is mostly useful for enterprise customers with custom API CNAME enabled (get in touch if you are interested in this feature).

🐛 Notable bugfixes

  • Disables sorting of array items when readOnly is set
  • Updates design of the presence menu to make non-clickable users appear greyed out
  • Updates @sanity/schema module with a new named export – the default export is now deprecated and will give a warning when used
  • Fixes behaviour so that the editing pane will now scroll the relevant field into view when validation does not pass
  • Improves readability for tags array inputs in read-only mode
  • Enables fetching unresolved cross-dataset references through GraphQL API

Version released on: February 08, 2023

Template improvements

Studio v3.3.1

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

Notable changes

  • Added ability to mark project studio templates as typescript-only

Version released on: February 08, 2023

Announcing Enterprise SSO

Manage v2023-02-01

✨ Highlights

Enterprise SSO

This release introduces support for granting project access and roles to users through declarative rules when using SSO. Read more in the announcement blog post.

Version released on: February 01, 2023

Bugfixes

Studio v3.2.6

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue that in some cases would prevent validation status from appearing for a document
  • Fixes an issue that ignored the readOnly state for fields inside fieldsets

Version released on: January 31, 2023

Improvements and bugfixes

Studio v3.2.5

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

Improve readability for document history dates

The document history timeline now displays full dates in tooltips on hover

Version released on: January 24, 2023

Improvements and bugfixes

Studio v3.2.4

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

Date range support in global search

It’s now possible to easily search for documents between two dates in the global search.

The global search now accepts filtering on date ranges

🐛 Notable bugfixes

  • Fixes an issue where a configured studio-wide basePath would not be respected in build output, and workspaces would have to manually include the prefix in each workspace base path
  • Enables access to studio-prefixed environment variables through process.env
  • Fixes an issue where replacing the image asset in an image field would sometimes fail silently
  • Fixes an issue where using React components in field titles or descriptions could crash global search

Version released on: January 17, 2023

Bugfix

Studio v3.2.1

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes a regression in groq@3.2.0 that is missing a default export affecting Node.js ESM runtimes

Version released on: January 12, 2023

Improvements and bugfixes

Studio v3.2.3

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes issue in the Node.js runtime wrapper causing the groq tagged template literal to sometimes be undefined

Version released on: January 12, 2023

Improvements and bugfixes

Studio v3.2.2

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue where the Node.js ESM specific export for groq were missing from the package published to npm
  • Fixes a potential race condition with duplicate keys when an editor deletes all the content of a portable text editor while other editors are editing the same document

Version released on: January 12, 2023

RxJS and Vite upgrade and bugfixes

Studio v3.2.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨Highlights

RxJS upgraded to v7

This is an internal change, but if you have RxJS as a dependency in your Studio project you should make sure to upgrade to v7 of RxJS in your package.json. Otherwise you may get build errors due to changes in the Observable interface between v6 and v7 (note: this is a type change only, and should not affect the runtime behavior of your studio).

If you get a build error saying something similar to:

TS2322: Type 'Observable<…>' is not assignable to type 'ObservableInput<any>'. Type 'Observable<…>' is not assignable to type 'Observable<any>'. The types of 'source.operator.call' are incompatible between these types. …

Then the solution is to upgrade the version of RxJS used in your project or library to 7.x. See the full list of breaking changes in RxJS 7

Vite upgraded to v4

This is an internal change, but theoretically there might be small changes to how assets are handled between v3 and v4. If you're using custom Vite plugins or you are loading CSS or other files, please make sure they still work after the upgrade.

Notable changes

  • Reintroduces some flags for sanity graphql deploy. Note that flags will apply to all configured GraphQL APIs.

🐛 Notable bugfixes

  • Fixes issue with useFormValue hook lagging one iteration behind
  • Fixes issue where the uploaded images menu was inaccessible
  • Fixes some incorrect typings in defineField() when using Rule.valueOfField() - thanks @fritz-c
  • Adds schema validation error when defining already defined field names for image and file types
  • Supports Node ESM (>=14)

Version released on: January 11, 2023

Improvements and bugfixes

Studio v3.2.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

RxJS upgraded to v7

This is an internal change, but if you have RxJS as a dependency in your Studio project you should make sure to upgrade to v7 of RxJS in your package.json. Otherwise you may get build errors due to changes in the Observable interface between v6 and v7 (note: this is a type change only, and should not affect the runtime behavior of your studio).

If you get a build error saying something similar to:

TS2322: Type 'Observable<…>' is not assignable to type 'ObservableInput<any>'. 
  Type 'Observable<…>' is not assignable to type 'Observable<any>'. 
  The types of 'source.operator.call' are incompatible between these types. 
…

Then the solution is to upgrade the version of RxJS used in your project or library to 7.x. See the full list of breaking changes in RxJS 7

Vite upgraded to v4

This is an internal change, but theoretically there might be small changes to how assets are handled between v3 and v4. If you're using custom Vite plugins or you are loading CSS or other files, please make sure they still work after the upgrade.

Notable changes

  • Reintroduces some flags for sanity graphql deploy. Note that flags will apply to all configured GraphQL APIs.

Notable bugfixes

  • Fixes issue with useFormValue hook lagging one iteration behind
  • Fixes issue where the uploaded images menu was inaccessible
  • Fixes some incorrect typings in defineField() when using Rule.valueOfField() - thanks @fritz-c
  • Adds schema validation error when defining already defined field names for image and file types
  • Supports Node ESM (>=14)

Version released on: January 11, 2023

Bugfixes

Studio v3.1.3

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue that could give false validation errors for complex documents
  • Hides restore action when revision is latest version
  • Improves responsiveness of file and image inputs for narrow widths
  • Restores transition effect when reordering primitive array values
  • Fixes an issue with the vision tool causing the query param errors tooltip disappear behind the above panel

Version released on: January 03, 2023

Bugfixes

Studio v3.1.2

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixed a regression with release 3.1.0 where a custom style in the portable text input would not fallback to be rendered as the normal style when a rendering-component for that style was not defined.

Version released on: December 22, 2022

Bugfixes and improvements

Studio v3.1.0

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

✨ Highlights

Improved customization and TypeScript support for the Portable Text Input and schemas

Improved support for custom rendering of the content in the Portable Text input via .components.block, component.inlineBlock and .components.annotation render callbacks for object-like schema types, references and type aliases.

While this has been possible previously by modifying the block schema locally, these customizations can now also be put directly on the various content types themselves, to be shared between different Portable Text inputs using them. For example you can now customize how an author reference would appear in various Portable Text contexts on the author schema itself.

Also text specific schema properties like decorators, styles and lists for the block type itself have slighly changed their configuration in order to better align with the rest of the studio. More info: Changes in block schema customization properties.

If you previously did customization of the editor using your own render callbacks or icons through the .blockEditor property in the block schema, you will get a deprecation warning, but they will still continue to work until further notice.

Please refer to the documentation for how to customize the block type and the Portable Text editor for v3 of the studio.

Besides this, the Portable Text input related code and schema types have been given a TypeScript update for better type safety and developer experience.

Studio appearance

The user menu now has options to select the appearance (color scheme) of the Studio. The selected appearance is stored in local storage and is reused on the next visit.

Logo component updates

The button in the navbar that wraps the custom logo component has no padding anymore. This update is made in order to give the custom logo component full control over how big the button in the navbar should be. Therefore, the custom logo component may need to be updated in order to achieve the previous look. Below is an example of how to recreate the same result as before:

import {defineConfig} from 'sanity'
import {Box} from '@sanity/ui'

function MyLogo() {
  return (
    <Box padding={3}> // <-- Wrap your custom logo with a `Box` with `padding={3}`
      <CustomLogo />
    </Box>
  )
}

export default defineConfig({
  // ... rest of config

  studio: {
    components: {
      logo: MyLogo,
    },
  },
})

🐛 Notable bugfixes

  • This update fixes so that the component in the root config (ie in defineConfig) is the component that receives the result of the props passed on with renderDefault in previous custom components.
  • Fixed an issue with custom sort orders

Version released on: December 21, 2022

Bugfixes

Studio v3.1.1

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npx create-sanity@latest

To upgrade a v3 Studio:

npm install sanity@latest

🐛 Notable bugfixes

  • Fixes an issue where createAuthStore would incorrectly require a client factory to be passed
  • Fixes an issue where lodash was not optimized in all released Sanity packages
  • Fixes an issue where disabling direct uploads when using multiple asset sources would not work

Version released on: December 21, 2022

Sanity Studio v3

Studio v3.0.2

This is the release of the stable, production-ready version the new major version (v3) of Sanity Studio. It deprecates Studio v2 and earlier versions. Studio v3 brings new features for content creators and developers, as well as a completely rewritten studio customization framework.

High-level improvements

  • The Parts system is deprecated and replaced with a new studio customization framework
  • Custom webpack tooling is replaced with Vite
  • Sanity Studio now ships as a single npm dependency (sanity) with JavaScript-based configuration (sanity.config.js|ts / sanity.cli.js|ts)
  • The Studio module also has full ECMAScript Modules (ESM) support and CommonJS fallback and can be run in all modern browsers without bundling and embedded in any web project
  • Full TypeScript coverage with annotated APIs (@internal, @beta, @public), new helper functions (defineType,defineField), and emerging inline documentation with TS Doc
  • Better abstractions for wrapping and composing Studio and Form Components with renderDefault(props) and other convenience functions.
  • New Plugins API with plugin development tooling (plugin-kit) that makes it easier to build, maintain, and publish plugins on npm
  • New Studio v3 templates that let you get up and running with best practices

Learn more about Studio v3

Version released on: December 07, 2022

Cross Dataset bugfix

Studio v2.35.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an edge case where a cross dataset reference to a deleted document would prevent you from changing the referring document

Version released on: November 15, 2022

Bugfixes

Studio v2.35.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue with documents not loading when rxjs version 7 is installed as a dependency

Version released on: October 28, 2022

Shared Content

Studio v2.35.0

✨ Highlights

Shared Content

This release introduces support for shared content through cross-dataset references. Read more in the announcement: https://www.sanity.io/blog/shared-content-introduction

Shared Content: Eliminate Content Debt

Improved search

Order search results by relevance, created and last updated date.

Improved search with option to order by relevance, creation date, update date

🐛 Notable bugfixes

  • Fixes an issue where split panes might not persist after reloading the studio
  • Fixes a bug causing revision history selector to always display the current version instead of the selected revision

Version released on: October 20, 2022

New empty template

Studio v2.34.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

Version released on: October 14, 2022

Bugfixes

Studio v2.34.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue causing content to be inserted twice when using custom paste handler

Version released on: October 12, 2022

Improvements and bugfixes

Studio v2.34.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Performance improvements

This release includes several performance fixes that should now make the Studio more responsive while editing documents. (See more details in individual PRs #3668, #3662, #3660)

Improved search

Search for documents containing an exact phrase by wrapping text inside double quotes.

Other features

  • Upgrade @sanity/ui to v.0.37.22

🐛 Notable bugfixes

  • Fixes an issue where the scroll position in global search wasn’t being correctly retained in some instances.
  • Fixes an issue in global search that would cause the studio to crash if Local Storage is unavailable.

Version released on: September 27, 2022

New CLI Feature flags and bugfixes

Studio v2.33.3

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

New CLI flags!

We've added a few new flags to make automation easier!

The --force flag was added to a few already existing commands and will skip the confirmation prompt and proceed with the command:

sanity dataset alias unlink <alias-name> --force

sanity dataset alias delete <alias-name> --force

sanity dataset delete <dataset-name> --force

sanity graphql undeploy --dataset <dataset-name> --force

When added, the --no-open flag prevents the login page from automatically opening in the browser.

sanity login --provider <provider-name> --no-open

Articles affected by this release

Version released on: September 21, 2022

Bugfixes and improvements

Studio v2.33.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes styling of a columnar fieldsets
  • Fixes an issue where older versions of Safari might crash when opening a referenced document
  • Fixes an issue with the cursor disappearing when arrowing down to the bottom of a collapsed Portable Text Input field
  • Fixes a Safari issue where the Portable Text editor's selection is reset when returning from an object edit modal of an embedded Portable Text object
  • Improved read only mode for the Portable Text Input

Version released on: September 14, 2022

Performance improvements

Studio v2.33.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli 

Upgrade Sanity Studio with:

sanity upgrade 

✨ Highlights

Performance improvements

This release brings a number of performance improvements, mostly related to excessive re-rendering of components that do not change. Notable improvements are:

  • Better performance for presence indicators when many users are logged in at the same time
  • The Portable Text Editor should be faster and re-render less often

🐛 Notable bugfixes

  • Mitigated an issue that could cause a draft document to be overwritten by an earlier version after publish
  • The Presence list in the toolbar will now only show users who are working in the same dataset

Version released on: September 08, 2022

Accessibility improvements

Studio v2.32.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

Accessibility improvements

  • Screen readers will now identify that the main language in the Studio is English
  • Various accessibility improvements

Version released on: September 07, 2022

Bugfixes

Studio v2.31.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixed an issue where incorrect references to image and file assets would crash the studio and display invalid diffs

Version released on: August 29, 2022

Improved search + bugfixes

Studio v2.31.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Improved search 🕵️

  • Adds support for filtering search results by any number of document types. You can also browse documents from any number of types without entering a search query.
  • Search is now toggleable with a hotkey (Command/Control-K) and fully navigable by keyboard.
  • Recent searches (including selected document types) are stored for later use
  • Search terms and results are retained upon close: handy if you want to quickly revisit or amend your last search
  • Improves performance when rendering and scrolling through large result sets
  • The search dialog is wider, giving you more space for the search result listing

NOTE: Documents listed in search results will no longer resolve custom components for block content and array views

Articles affected by this release

Version released on: August 24, 2022

Bugfixes

Studio v2.30.5

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Improved the UX of the new reference indicator in document pane.

Version released on: August 15, 2022

Bugfixes

Studio v2.30.4

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes a bug where desk tool document lists would sometimes fail to resolve a schema type for new documents when pane supports multiple types
  • Reduces amount of requests triggered by new reference indication
  • Fixes 404-errors being printed in developer console when checking references for unpublished documents


Version released on: August 05, 2022

Improvements and bugfixes

Studio v2.30.3

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Notable changes

  • A document that has references to it will now clearly indicate this with a differently colored header/footer, as well as with a link symbol. Additionally, prior to publishing a referenced document, a confirmation dialog will indicate that the change might affect referencing documents
  • Added support for the presence feature when not using cookies for authentication
  • Dependencies upgraded for the Portable Text Editor, fixing issues where Chrome would be reported as missing beforeInput- support after Chrome went above version 100. This broke spellchecking in Chrome and degraded performance
  • Updated UI of dashboard feeds

🐛 Notable bugfixes

  • Fixes rare occurring bug in the Portable Text Editor where it would stop producing patches due to non-updated instance props
  • Fixes issue where the newest get-started templates did not include a gitignore file
  • Fixes a potential error when trying to access a file that does not exist
  • Fixes issue where field validation tooltips would sometimes be cut off when inside of modals
  • Fixes an issue where exporting certain old assets would fail because of an md5 mismatch
  • Fixes an issue where the unpublish dialog would use the term "delete" instead of "unpublish" in the confirm dialog
  • Fixes a few warnings from being printed when navigating the dashboard
  • Fixes an issue where documents with a large amount of references would sometimes fail to be published because of a failing request
  • Fixes an issue where a stray margins property would be passed to a div-element (thanks @KittyGiraudel!)
  • Fixes a few typos in the pets project template (thanks @nick-krantz!)Upgrade the Command Line Interface (CLI) with:

Version released on: August 04, 2022

Improvements and bugfixes

Studio v2.30.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Add command to list information about dataset jobs

This new command will help users find out the status of jobs without needing the job id.

`sanity dataset jobs list`

Version released on: June 20, 2022

Bugfixes

Studio v2.30.1

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes hovering issue in array input with portable text block
  • Fixes issue where selected list ordering in desk structure would not be respected
  • Fixes issue where document list appeared to be loading forever when changing the ordering
  • Fixes issue where the the code input file name field would disappear when the language option was set
  • Improves error message when copying a dataset and the target dataset already exists, but a copy operation is already in progress

Version released on: May 31, 2022

Improvements and bugfixes

Studio v2.30.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

  • CLI copy dataset command now always prints a job id to make it easier to resume watching running jobs
  • It is now possible to navigate to a referring document from the 'delete document' dialog

🐛 Notable bugfixes

  • Fixed an issue where sanity deploy would return "Hostname already taken" for all errors
  • Added explanation in sanity exec --help on how to add arbitrary arguments to the script
  • Fixed date formatting issue in validation tooltip
  • Added scroll to the types dropdown menu when creating a new reference

Version released on: May 10, 2022

Bugfixes

Studio v2.29.8

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue where the studio might crash when publishing due to a change in a third party dependency
  • Fixes an issue where user avatar from Google would sometimes not appear
  • Fixes a typo in the studio update dialog
  • Fixes a bug where initializing new projects with a dash in its name would not include it in the suggested output path

Version released on: April 29, 2022

Onboarding update (Get Started template)

Studio v2.29.7

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

First step of Get Started carousel

As part of a general effort to improve our onboarding experience, this release updates the studio templates available in the CLI.

These release notes also covers v.2.29.6

Version released on: April 26, 2022

Dry run mode for `sanity graphql deploy`

Studio v2.29.5

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Dry run mode for sanity graphql deploy

You can now preview GraphQL deployments and check for breaking changes without deploying.

Version released on: April 07, 2022

Bugfixes

Studio v2.29.4

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes regression in the previous release regarding pasting of HTML into the Portable Text Editor.
  • Fixes a rare bug with pasting plain text into the Portable Text editor where it sometimes would error and deny the paste.

Version released on: April 01, 2022

Improvements and bugfixes

Studio v2.29.3

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Select organization with the CLI

Allow selecting an organization to attach new projects to during sanity init.

Other features

  • Update image input height based on image size.
  • Adds support for @sanity/language-filter to fallback to a different language select implementation when the current one is not relevant. (thank you @LiamMartens)

🐛 Notable bugfixes

  • Improves how patches are sent to the server in the Portable Text editor, potentially fixing a very rare heisenbug where the latest change in the editor would not be persisted.
  • Fixes a regression in the Portable Text editor's custom paste handler support.
  • Fixes issues in the Portable Text editor when merging two paragraphs with text annotations in some circumstances.
  • Fixes an issue where the number input wasn't allowing for decimal numbers (when the input is active).
  • Fixes an issue with the changelog when filtering out entries without data to display.

Articles affected by this release

Version released on: March 30, 2022

Bugfixes

Studio v2.29.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue where client configured with a token via part:@sanity/base/configure-client would be reset.

Version released on: March 23, 2022

Fix broken release

Studio v2.29.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue with the v2.29.0 release that prevented the @sanity/default-layout module from being installed

Version released on: March 16, 2022

New changelog dialog + bugfixes

Studio v2.29.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

New changelog dialog

The Studio now has a new changelog dialog that features more in-depth information about the latest features and bugfixes.

🐛 Notable bugfixes

  • Fixes an issue in array inputs where the input was disabled when dragging items within a Portable Text Editor

Version released on: March 16, 2022

New point of presence for APICDN: Mumbai, India

Content Lake v2022-03-13

Added a new point of presence for our APICDN in Mumbai, India.

Articles affected by this release

Version released on: March 13, 2022

Bugfixes

Studio v2.28.2

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue where sanity exec would use an unauthenticated user session for the client

Version released on: March 10, 2022

Bugfixes

Studio v2.28.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Temporarily bring back the internal ConfirmDelete component from @sanity/desk-tool which was depended on by certain plugins

✨ Highlights

  • Allow using a writable stream as the output destination in the @sanity/export module (thanks @tsolbjor!)

Version released on: March 09, 2022

Improved studio authentication and bugfixes

Studio v2.28.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

  • Adds a check for superfluous image metadata properties being specified
  • The studio now supports authentication for browsers that block third-party cookies

🐛 Notable bugfixes

  • Fixes a bug where document lists would not always show items in the correct order until scrolling down and back up again
  • Fixes a bug where the studio could crash if a user had insufficient permissions to fetch user profiles while collaborating with others
  • Fixes a number of issues with the sanity upgrade command when using --tag or --range
  • Upgraded @sanity/base to use react-refractor version 2.1.6 (thanks @JamesSingleton!)
  • Upgraded @sanity/base to use refractor version 3.6.0 (thanks @miketheman!)

Version released on: March 08, 2022

Improved CLI upgrade command and Portable Text editor bugfixes

Studio v2.27.3

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes a number of issues with the sanity upgrade command when using --tag and/or --range (#3176)
  • Fixes a bug in the Portable Text editor where selecting all the content and overwriting it by inserting text would cause an error

Version released on: March 03, 2022

Structure apiVersion bugfix

Studio v2.27.2

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes an issue where the defined `apiVersion` would not be used for document lists in the desk tool structure (thanks @barbogast!) (#3174)

Other changes

  • Upgrades refractor dependency to ensure a prismjs security upgrade is included (thanks @miketheman!) (#3170)

Version released on: March 01, 2022

Bugfixes and improved Portable Text Editor keyboard navigation

Studio v2.27.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

  • Adds keyboard arrow navigation in the Portable Text Editor toolbar (#3126)

🐛 Notable bugfixes

  • Fixes an issue where spellchecking in the Portable Text Editor would not be enabled when omitted in schema options. (#3146)
  • Fixes a bug where Portable Text block values without a defined style property would throw an error when editing that block. (#3161)
  • Improves the performance of the reference search. (#3159)

Version released on: February 22, 2022

More Presence and various bugfixes

Studio v2.27.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

More Presence

Presence avatars in document lists

Presence, the ability to see where your collaborators are, is now visible in document lists, search results, and reference previews.

Other features

  • You can now configure the default API version for Vision (#3127)

🐛 Notable bugfixes

  • Removes a false positive validation error with some nested image and file fields (#3119)
  • Fixes a bug where adding marks to a Portable Text block would remove some existing marks (#3124)
  • Fixes a bug where list items in Portable Text without a level would cause an error (#3129)
  • Fixes a bug where read-only arrays showed an empty actions menu (#3130)
  • Improves empty read-only state for arrays (#3131)
  • Adds validation warnings on incorrectly implemented asset sources (#3135)

Version released on: February 08, 2022

Minor release: File and Image Input, PTE and Login Status

Studio v2.26.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Updated File and Image Input

File component

  • Empty state takes up much less vertical space
  • Field with file selected also takes up less vertical space
  • Display original file name and size
  • Options to download the file or copy the url

Image component

  • Empty state takes up much less vertical space
  • Image is vertically responsive to the height of the window, taking up less vertical space
  • Images are no longer enlarged to fit the size of the field
  • Options to copy image url and download the image
File Input
Image Input

Improved change indicator highlighting in Portable Text Editor

PTE review changes

Updated login status popover to display information about the current user

  • Shows full name, email and login provider of the logged in user
  • Link to project management interface
Login popover improvements

🐛 Notable bugfixes

  • Fixes an issue where the empty editor placeholder text would sometimes cause focus problems in Webkit.
  • Fixes an issue where multiple types in array input would prevent it from being scrollable

Version released on: February 01, 2022

Bugfixes

Studio v2.25.4

Upgrade the Command Line Interface (CLI) with:

Comment

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes a bug in the Portable Text Editor where opening inline objects of type reference would not open the editing interface if the reference was set already
  • Fixes issue where document preview images weren’t updating when changed
  • Fixes issue where array items with initial value were overriding set values when duplicating

Version released on: January 27, 2022

Patch release

Studio v2.25.3

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes a bug where pasting into an empty Portable Text Editor would cause an error
  • Fixes race condition that caused a crash in the studio when arrays were used

Version released on: January 26, 2022

Major version upgrade to the JavaScript Client (@sanity/client)

JavaScript Client v3.0.0

Breaking changes:

  • The client will now fetch from the API CDN when a token and useCdn: true are passed together.
  • The client now only supports Node.js v12 and higher.
  • The deprecated merge patch operator was removed.
  • The deprecated document property on assets.upload was removed.
  • client.observable.fetch() returns a cold observable.

Articles affected by this release

Version released on: January 26, 2022

Patch release

Studio v2.25.2

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes a bug introduced in v2.25.1 where inserting object blocks in the Portable Text Editor would cause an error

Version released on: January 26, 2022

Bugfixes

Studio v2.25.1

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

🐛 Notable bugfixes

  • Fixes some permission issues where users weren't able to edit documents when they should be
  • Fixes a bug where placeholder text in an empty Portable Text Editor would be stuck for a split second when it should not be
  • Fixes a bug where splitting lines in the Portable Text Editor including an inline object would corrupt the inline object data
  • Fixes an issue in Vision where controls and result were cut off in smaller viewports

Version released on: January 26, 2022

Add filtering of project members table

Manage v2022-01-26

Adds filtering by name, email and roles in project members list

Version released on: January 26, 2022

Portable Text Editor improvements. Eslint config. Bugfixes.

Studio v2.25.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Maintainance update to the Portable Text Editor

This update brings fixes for several bugs and improvements to the Portable Text Editor's performance and reliability. It also includes:

  • Better keyboard accessibility when editing embedded objects
  • Better tracking of validation errors within the editor
  • Better Android and IME support

Default .eslintrc file when creating new projects with the CLI

New projects bootstrapped with the CLI will now contain a default .eslintrc that extends our new shared ESLint config @sanity/eslint-config-studio.

🐛 Notable bugfixes

  • Fixed an issue where sanity upgrade would fail if @sanity/code-input was installed. (Thanks Tommy for the PR!)
  • Fixed an issue where sanity upgrade, sanity versions and sanity debug would fail if running without any dependencies installed.
  • Removed third party dependency causing security warnings with npm audit (immer.js)

Version released on: January 19, 2022

New features and bugfixes

Studio v2.24.1

Features:

  • Allow loading more syntaxes for the @sanity/code-input programmatically, see the code input README for more details
  • You can now specify coupon codes when creating a new project using the CLI, by using the --coupon flag, eg sanity init --coupon <code>

Notable bugfixes:

  • Fixes bug where initial values would no longer work when inserting in arrays
  • Fixes a bug that caused some false warnings with duplicate and update permissions

Version released on: January 17, 2022

Field groups, bugfixes and more

Studio v2.24.0

Upgrade the Command Line Interface (CLI) with:

npm install --global @sanity/cli

Upgrade Sanity Studio with:

sanity upgrade

✨ Highlights

Field groups

Added Field Groups to schemas and document view. Read more about the feature here: https://www.sanity.io/docs/field-groups.

New array item menus

Arrays now support adding new items before/after existing array items, and also duplicating existing items.

New and improved document status indicator

Updated document status indicator with saving state and animation.

Other features

  • Added SANITY_STUDIO_PROJECT_NAME environment config variable

🐛 Notable bugfixes

  • Fixed an issue that could in some cases cause matching documents to be excluded from the search results
  • Made the default title of referenced document types more user friendly
  • Fixes an issue that could occasionally cause a query error during publish of a new document created directly from the reference input
  • Fixes an issue that caused singleton documents to never load if no schemaType was provided.
  • Fixes UI issue in Portable Text toolbar

Articles affected by this release

Version released on: January 11, 2022

Bugfixes and changes to the Sanity CLI upgrade command

Studio v2.23.3

Changes to sanity upgrade

sanity upgrade now behaves slightly different:

  • It now respects the version ranges and pinned versions declared in your package.json
  • Tries not to upgrade non-studio modules such as @sanity/block-content-to-html
  • Shows a more prominent message if there are major updates available with a link to the changelog

Bugfixes

  • Fixes an issue that caused a crash instead of a warning screen when omitting schemaType from S.documentList() (#3022)
  • Fixes an issue that caused singleton documents to never load if no schemaType was provided (#3043)

Version released on: January 04, 2022

Bugfixes

Studio v2.23.2

  • Fixes a bug that caused focus loss on an array item after closing the edit dialog
  • Fixes a bug that caused popovers from closing when clicking outside of the current pane content
  • Fixes an issue that could cause a max request size exceeded error for documents that had many references.
  • Fixes a bug that could sometimes cause document preview for object fields with name "title" to crash on reload
  • Added more details in docs for the client.delete() API

Version released on: December 17, 2021

Bugfixes

Studio v2.23.1

  • Fixes an issue where previews of a reference to a document with a field named 'title' did not display correctly
  • Fixes a visual error where popover dialogs were appearing beneath other panes
  • Fixes an issue where 'create' intents set in custom structures would not appear in pane headers
  • Fixes sanity dataset import when targeting an ndjson file with relative file URLs
  • Fixes a bug preventing sanity logout from working in the case of expired sessions
  • Fixes a bug where the CLI would not be able to log a user in if an existing invalid/expired session was present

Other features

  • Added support for HTTP proxies when using dataset import/export commands
  • Validation menu button now reflects the highest level of validation

Version released on: December 14, 2021

Minor version bump! Several new features!

Studio v2.23.0

References in place

Users can now create a reference to a draft within the context of the referring document. This allows for a smoother workflow where having to leave the document you are working on in order to create and publish the document you wish to refer to is no longer necessary,
This new behavior of the reference input can be disabled by setting the property disableNew: true.

More:

Conditional readOnly fields and fieldsets

The ability to define if a field is editable based on conditions defined in a schema.

Info-level validation

In addition to being able to provide validation errors, developers can also provide guidance with ℹ️ -symbols to give in-line help to editors.

New modal options in Portable Text editor

The Portable Text editor now supports a new modal option with a type and width property. This means you can customize the size of annotation popovers (a much requested feature).

  type: 'block',
  marks: {
    annotations: [
      {
        type: 'object',
        name: 'link',
        title: 'Link',
        options: {
          // 👇👇👇
          modal: {
            type: 'popover',
            width: 'medium' // the default is "small"
          },
          // 👆👆👆
        },
      },
    ],
  },
  // ...
  • Fixes a case where the sanity graphql deploy command would not exit after a successful deploy.
  • Fixes a bug where importing the @sanity/eventsource module in non-browser, non-node.js environments could potentially crash because of a window reference.

Articles affected by this release

Version released on: December 08, 2021

Bugfixes

Studio v2.22.5

  • Fixes an issue where desk structures with observables would be stuck loading.
  • Fixes an issue where the new-document dialog would not use the selected template

Version released on: December 06, 2021

Bugfix

Studio v2.22.4

Fixes a bug that disabled all options in the global 'create document'-menu due to insufficient permissions.

Version released on: December 02, 2021

Bugfixes

Studio v2.22.3

  • Introduces a larger initial min-width for the DocumentPane.
  • Huge GROQ queries will now use the API-CDN when useCdn: true. Previously these would go to the regular API endpoint.
  • Fixes typo in deferred-visibility for mutations
  • Added schema option to configure spell-checking for Portable Text via options.spellCheck on the block type.

Version released on: November 30, 2021

Bugfix

Studio v2.22.2

Fixes a bug in Safari where editing annotations (like links) in the portable text editor would make the popover dialog jump around.


Version released on: November 18, 2021

Bugfix

Studio v2.22.1

Fixes an issue where some custom styles implementations for the Portable Text Editor caused an error.

Version released on: November 17, 2021

Portable Text Editor Input migrated to Sanity UI

Studio v2.22.0

Portable Text Editor Input migrated to Sanity UI

We have now migrated the Portable Text (PT) editor in the Sanity Studio to use Sanity UI. This marks the completion of the migration of the entire Studio to @sanity/ui.

OLD! Portable Text Editor in v2.21.11
NEW! Portable Text Editor in v2.22.0

In addition to the migration:

  • Generally improved stability and performance of the PT editor.
  • Added a new affordance for editing/removing text annotations. This will make it easier to e.g. edit link details.
  • Fixed a bug where undo/redo history was not maintained in memory when collapsing/expanding the editor.

Other features

  • Allows plan selection with sanity init --project-plan <plan>
  • Improves usability of ValidationError by making cloneWithMessage optional

Version released on: November 16, 2021

Bugfix

Studio v2.21.11

Fixes an issue causing sanity exec to crash

Version released on: November 10, 2021

Fixes for the pane and intent resolver

Studio v2.21.10

This release includes a new implementation of our pane and intent resolver that resolves intents deeper in your structure and provides more consistency with getDefaultDocumentNode. The Studio will now do a better job at opening a document within a structure instead of opening it on the root level outside of its usual context.

  • Fixes an issue where creating a new document would open in the fallback editor instead of as a child to the current pane.
  • Fixes an issue where opening a search item from the top search would result in the fallback editor instead of user-defined structure.
  • Fixes inconsistencies with getDefaultDocumentNode where configured views would not appear in the fallback editor.

Other fixes

  • Fixes an issue with GraphQL deploy causing "Error: Cannot find module '@sanity/core/_internal'
  • Support for GROQ query params in patch and delete methods in the client (#1826). Thanks, @KarlGe!


Articles affected by this release

Version released on: November 09, 2021

Bugfix

Studio v2.21.9

Fixes a regression introduced in #2884 that caused the saving spinner to not appear while a change was still syncing

Version released on: November 02, 2021

GraphQL Deploy Bugfix

Studio v2.21.8

Fixes an issue causing GraphQL deploys to fail after installing to babel ^7.16.0 see (#2899).

Version released on: November 01, 2021

Bugfixes

Studio v2.21.7

  • Fixes a bug where removing an annotation from text would interfere with other annotations within that same block
  • Fixes a bug where the correct version of a document did not appear when selected in the select revision menu
  • CLI now supports an increased maximum dataset name length of up to 64 characters

Version released on: October 26, 2021

Fixes match operator bug and corrects Content-Type for /history and /export

Content Lake v2021-10-21

Fixes match operator bug

Up until now, the match operator has not handled wildcards correctly in some specific situations.

For example, name match "foo.*bar" would be equivalent to foo * bar, because . would be considered a word-splitting character, and so foo.*bar would never match the string foo.bar.

While rare, this also turned out to affect some languages where we would split words incorrectly: "創傷ケア" match "創傷ケア*" would return false, but "創傷ケア" match "創傷ケア" would return true.

We are now releasing the API version 20211021, which fixes this.

In short, the new algorithm honours Unicode word segmentation rules and considers the wildcard character, *, to be a word character. This fixes the internal tokenization to be consistent.

Correct Content-Type for /history and /export

Previously the /export and /history endpoints was returning Content-Type: text/plain even though they were streaming JSON. After this version they return Content-Type: application/x-ndjson instead.

Articles affected by this release

Version released on: October 21, 2021

Bugfix

Studio v2.21.6

Fixes an issue that could cause an error saying “This document is of type X and cannot be edited as Y.” when navigating between singleton documents

Version released on: October 21, 2021

Bugfixes

Studio v2.21.5

Fixes a bug where if a space was configured as the default but not the first in the spaces array, the initial studio load would redirect to the correct URL but not configure the client to use the correct dataset.

  • Fixes an edge case for user-defined components. All user-defined components are re-rendered on navigation regardless if the structure child is a function or not.
  • Fixes an issue where user-defined components would not be hidden when pane was collapsed.
  • Fixes sluggish UI in the image select dialog when the list contained large GIFs.
  • Fixes image select dialog scrolling to top when loading a new page.
  • Fixes an issue where deploying a GraphQL API might crash if schema-imported component tries to access localStorage.
  • Fixes an issue where switching betweeen two "singletons" (document list items) without a defined schema type might result in the incorrect schema type being used.
  • Fixes a styling issue in the @sanity/vision autocomplete styling.
  • Fixes an earlier regression that caused the withDocument higher-order component to pass on the edited document before it was fully loaded.
  • Fixes a bug where removing an annotation in the beginning of a Portable Text block would accidentally mutate trailing annotations inside that same block.

Version released on: October 19, 2021

Bugfixes

Studio v2.21.4

  • Fixes a bug where the withDocument higher-order component would sometimes return null initially
  • Fixes a bug where collapsed panes might not show their content when expanded
  • Fixes a bug where tools would not get passed the tool property, resulting in incorrect context

Version released on: October 15, 2021

Patch release - Several bugfixes

Studio v2.21.3

  • Fixes an issue that caused the GraphQL schema deployment to either be slow or hang on schemas with many references
  • Fixes an error where the image and file inputs might throw an error about unsetting deep values on a primitive value
  • Fixes glitches in logo animation when the studio is loading
  • Fixes an issue where the desk tool would in certain cases give an error message saying Unknown document type *
  • Fixes an issue where document list items inside of non-document lists would be rendered with “Untitled” as the title, instead of the full document preview
  • Fixes an issue where the schema error summary would not be displayed because the studio would crash before being able to display it
  • Fixes a regression that caused the withDocument higher-order component to get stuck on an initial null value
  • Fixes an error where the client would fail to set up a listener when sending huge queries, without giving a developer-friendly error message

Version released on: October 14, 2021

Bugfixes

Studio v2.21.2

  • Fixes UX issues with collapsing and expanding panes in the Desk Tool.
  • Adds support for scrolling in the date picker‘s popover, when it’s not able to show all the contents at once.

Version released on: October 08, 2021

Bugfixes

Studio v2.21.1

  • Fixes issue with experimental spaces not loading correctly (#2835)
  • Fixes an issue with nested document lists. (#2834)
  • Fixes an issue that would disallow deleting an unpublished document for users with access to update the draft
  • Fixes an issue that would disable discarding drafts even for users that had access to it

Version released on: October 07, 2021

Default layout and Desk tool migrated to Sanity UI

Studio v2.21.0

Fully migrated @sanity/default-layout to Sanity UI

The navbar and all of its elements have been migrated with @sanity/ui. The migration fixes a long-standing issue with responsiveness of the navbar, especially when it comes to the tool menu.

Fully migrated @sanity/desk-tool to Sanity UI

The pane system has been rewritten from scratch, and the UI of Desk Tool is completely refactored to using @sanity/ui.

Panes now support dynamic minimum and maximum widths, to provide a more responsive behavior.

Other features:

  • Newly initialized studios will now include a .gitignore
  • Speed of dataset imports improved when assets already exists
  • sanity hook commands updated to be forwards-compatible with upcoming webhook changes

Notable bugfixes:

  • fix(language-filter): fixes popover placement issue when language list is long (#2801)

Version released on: October 06, 2021

New GROQ-Powered Webhooks

Webhooks v2021-10-04

A complete revamp of the webhooks API, which allows for sophisticated webhook configuration using GROQ. Read more in the docs, or read the announcement blog post.

Migrating the legacy webhook behavior to GROQ-powered Webhooks

If you need to recreate the previous webhook behavior – triggering on all changes, and on a dataset level rather than document-level – you can do so by following these steps:

  1. Create a webhook set to trigger on create, update and delete
  2. Leave the Filter field empty
  3. Add the following to the Projection field
// webhook projection
{
  "transactionId": "Not supported",
  "projectId": sanity::projectId(),
  "dataset": sanity::dataset(),
  "ids": {
    "created": [
    	select(before() == null && after() != null => _id)
    ],
    "deleted": [
      select(before() != null && after() == null => _id)
    ],
    "updated": [
      select(before() != null && after() != null => _id)
    ],
    "all": [
      _id
    ]
  }
}

You can also click this link to get a template with the settings described above.

Other improvements


In addition to the filter and projection functionality, we’ve made a bunch of other improvements as well:

  • There’s a new UI for webhooks in the management interface and a full RESTful API
  • Webhooks can now be edited after you have created them
  • You can enable and disable webhooks
  • Webhook entries contain more metadata, including name, description, and more
  • You can add custom headers, and specify its HTTP method
  • There’s a new attempts log that makes troubleshooting and testing easier
  • Webhooks support a secret that will be hashed in the request which you can use to authenticate that the request originates from your project
  • We include idempotency keys in the headers, which you can use when syncing data to verify you haven’t received it before
  • Webhook configurations can be shared via URL
  • Webhooks are now guaranteed to include the content changes that caused them
  • Webhooks will now be retried (and are also rate-limited to 60 per second)
  • We also added a `sanity` namespace to GROQ that can be used in projections

Articles affected by this release

Version released on: October 04, 2021

GraphQL Date comparison bug fix

GraphQL v2021-09-28

Fixes a bug when trying to filter on a Date type

Version released on: September 28, 2021

styled-component as first-level dependency

Studio v2.19.0

styled-component as a first-level dependency

We've been hard at work migrating the internals of Sanity Studio from CSS modules Sanity UI, which is based on styled-components.

Over the past releases, we've seen a few reported issues where multiple versions of the styled-components dependency could end up in the same studio, causing issues that were hard to understand (sanity is undefined) and would require a full dependency tree reinstall to resolve (rm -rf node_modules && sanity install).

In this version, we're introducing styled-components as a first-level dependency in the studio, in the same way that react and react-dom is.

The first time you run sanity start, sanity build or sanity upgrade after the upgrade, you will be asked to install the dependency - and in non-interactive it will install automatically.

This migration should be seamless for most studios. We anticipate that in certain cases (custom monorepo setups, for instance) it might require manual changes, like adding styled-components as a dependency of the studio.

For a more in-depth look at the rationale behind this change, see the pull request for this change.

Specify API version for CLI query command

The sanity documents query CLI command now has a new flag: --api-version.

This is useful for testing how queries behave in different API versions. For now, the command will still use v1 as the default.

Notable bugfixes

  • Fixes a rare case where an error could be thrown during the React render lifecycle without being an Error instance, which would crash the error boundary


Version released on: September 13, 2021

New login screens

Manage v2021-09-13

Login screens are refactored to use Sanity UI.

Version released on: September 13, 2021

Throw error on invalid image source

Image URL library v1.0.0

Previously, the @sanity/image-url library would return `null` if you passed an invalid source (such as an object without the expected properties, or an invalid image asset ID). From 1.0.0 and onwards, the library will throw when receiving an invalid source. This makes it more obvious when there is invalid data passed to it, as well as ensuring that the function always returns a string (which is a much requested feature for TypeScript users).

Version released on: September 01, 2021

Removing warning for new fields in GraphQL schemas

Studio v2.17.2

Removing warning for new fields in GraphQL schemas

If you add schema fields and run sanity graphql deploy you will no longer be warned about “dangerous changes.” Previously, our GraphQL validation followed the behavior of graphql.js, which treats added fields as “dangerous.” We have had a lot of feedback, that in practice, it has been more bothersome than useful.

🐛 Notable bugfixes

  • Since v2.16.0, (inline) references in Portable Text would not be saved properly and left an arbitrary attribute. This version fixes that.

Articles affected by this release

Version released on: August 31, 2021

Conditional Fields

Studio v2.17.0

A lot of you have been waiting for this for a while: A way to show and hide fields based on the value of some other field. The wait is over! In this release of the Sanity Studio the hidden field has been upgraded to take a callback function.

export default {
 type: 'object',
 name: 'dropdownExample',
 fields: [
   {
     name: 'kind',
     type: 'string',
     options: {list: ['foo', 'bar', 'baz']},
   },
   {
     name: 'fooOptions',
     type: 'object',
     hidden: ({parent}) => !(parent?.kind === 'foo'),
     fields: [/* ... */],
   },
   {
     name: 'barOptions',
     type: 'number',
     hidden: ({parent}) => !(parent?.kind === 'bar'),
     fields: [/* ... */],
   },
 ],
}
Conditional Fields with dropdown

Get more code examples and read more about the details in our docs.

Version released on: August 25, 2021

2.15.0

Studio v2.15.0

Highlights

  • Migrates `color-input` to `@sanity/ui`
  • Migrates `google-maps-input` to `@sanity/ui`
  • Migrates the document status bar and document actions to `@sanity/ui`
  • Migrates the default preview to `@sanity/ui`

Bugfixes

  • Adds a visible indicator on the focused day when using arrow keys to navigate through the calendar days in the date input
  • Fixes an issue that in some rare cases could make the preview selection result in an invalid query
  • Fixes an active state issue with `PaneItem` in `DocumentsListPane`

Version released on: August 17, 2021

2.14.0

Studio v2.14.0

Features


  • Adds a notice for insufficient permissions to references
  • Adds strict dependency checking to all packages
  • Adds better feedback about accepted files when dragging over file and image inputs

Bugfixes

  • Enforces that DateInput value is constrained to timeStep
  • Fixes issue where importing JSON files would crash the studio build process
  • Fixes an issue where the form was visible above the PTE toolbar in fullscreen mode
  • Adds safeguard against missing .focus() method on components used with the withDocument() higher order component.
  • Adds a visible indicator on the focused day when using arrow keys to navigate through the calendar days in the date input
  • Fixes an issue that in some rare cases could make the preview selection result in an invalid query

Version released on: August 11, 2021

Replace picosanity with full client

next-sanity v0.2.0

The first version of next-sanity shipped with the picosanity client built-in. This caused some confusion for people who wants not only to pull data from their Sanity.io content lake, but also send patches and mutations via API routes. Since picosanity only supported fetching content, it had a smaller bundle size than the full SDK.

This version replaces picosanity with the full client. You can use Next.js' tree shaking to keep the client out of the app bundle or install picosanity if you still prefer to use that.

Version released on: May 13, 2021

v2.10.0

Studio v2.10.0

Initial values for any type

This upgrade extends support for initial values to any field, not just the document type. You can now set initial values on a field that's shared between schema types. It also allows for initial values for fields inside of arrays and the Portable Text editor, which has been a frequent request. Initial values still supports promises if you need to set values from external data sources.

Initial values for any type

🐛 Notable bugfixes

  • Fixes a few performance regressions in the array input
  • Fixes an issue where the "revert changes"-dialog confirmation would sometimes be hidden behind the form dialog

Articles affected by this release

Version released on: April 28, 2021

v2.9.0

Studio v2.9.0

Improved image fields

The image fields has seen a number of bugfixes and now properly display presence and change indicators, including for hotspot/crop fields and other image fields that opens in dialogs.

Sanity UI powered reference input

The default reference input in Sanity Studio has been refactored to use the Autocomplete component from Sanity UI which improves overall accessibility and fixes keyboard navigation bugs.

Other features

  • The language filter can now be configured with an array of document types to control which schemas the filter will appear on (thanks @spacedawwg!).

🐛 Notable bugfixes

  • Fixes false positive with image fields in dialogs, indicating that there’s a change when there is none
  • The code input now wraps text inside the input so that all the code is visible without having to scroll horizontally (thanks @katherinepeterson!)

Version released on: April 26, 2021

Fix gatsbyImageData

Gatsby source plugin v7.0.3

Bugfixes

  • Bring back the gatsbyImageData on image nodes
  • Set more specific peer dependencies and engines update

Explore the diff

Version released on: April 13, 2021

@sanity/ui v0.33.11

Sanity UI v0.33.11

Most changes in this version are improvements and bug fixes behind the scenes – however there are a few new APIs:

New properties

  • Introduced the onItemSelect property ((index: number) => void) to the Menu component props, to make it possible to subscribe to which MenuButton is currently selected.
  • The MenuItem now takes the selected property (boolean) to indicate which item in a Menu should be selected by default.
  • The MenuButton component now takes the popover property (PopoverProps), which is an object containing properties for the Popover component (like arrow, preventOverflow, portal, and so on).
  • The Popover component now takes a matchReferenceWidth property (boolean) to render the popover with same width as the referred element.

Version released on: March 29, 2021

Add support for API versioning

next-sanity v0.11.1

This release upgrades the picosanity dependency that brings support for configuring the client's API version:

import {
  createClient
} from 'next-sanity'

const config = {
  dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || 'production',
  projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
  useCdn: process.env.NODE_ENV === 'production',
apiVersion: '2021-03-25'
} export const sanityClient = createClient(config)

Version released on: March 26, 2021

Query optimizations and bug fixes

GROQ v2021-03-25

New features:

  • Optimize *[a[].b match "foo"]
  • Optimize nested paths (e.g. *[foo[].bar[].baz match "bar"]). This also makes them possible to use inside score().

Bug fixes:

  • Fix *[foo == null] when foo refers to an empty object
  • Fix some edge case bugs related to negation.

Version released on: March 25, 2021

GROQ specification compatibility, introduction of namespaces, and new functions

GROQ v2021-03-25

Content Lake is a full refactor of Sanity's backend and query engine. You can start using it by upgrading and specifying an API version for your client. Content Lake follows the GROQ specification and introduces both bug fixes and new features.

We have updated the documentation to reflect the newest version. This changelog contains the breaking changes and migration paths you need to take. You can take your time and stay on v1 for as long as you need, while you test and compare your queries against the new version. You can also specify the API version for only new queries to gradually move over. Let us know in the community if you have questions or need help.

Breaking changes from v1 to v2021-03-25

Correct parent operator behavior (^)

The GROQ ^ operator now works correctly in all scopes.

This fixes the known issue where the ^ operator only worked in subqueries. In all other scopes, it returned the root of the current scope, instead of the parent scope.

*[_type=="person"]{
  name,
  someObj{
    name,
    // Old Behavior: "parentName" returns someObj.name
    // New Behavior: "parentName" returns root name value
    "parentName": ^.name
  }
}

Consistent handling of true/false/null for equality/comparisons operators

GROQ now uses three-valued logic consistently:

  • >, >=, <, <= returns null when the operands are of different types.
  • &&, || handles null "as expected": null && truenull and null || truetrue.

Note that == has changed slightly:

  • It now always return either true or false (never null).
  • You can compare against null and get the expected result: 123 == nullfalse and null == nulltrue.
  • Comparisons between other types than strings/booleans/numbers always return false.

This also means that in works with null: null in foo will return true if foo is [null, 1, 2].

in null always returns null.

Consistent array traversal

We have cleaned up the behavior for array traversal. For example, queries that contained multiple array traversals that don't work in v1, now work as expected in v2021-03-25 and onward.

*["link" in body[].markDefs[]._type]
// v1: No results
// v2021-03-25: An array of documents that has a link annotation in their "body" field

// Data:
[
  {
    "_type": "book",
    "authors": [
      { "names": ["MH", "Holm"] },
      { "names": ["Bob"] },
    ]
  }
]

// Query:
*[_type == "book"].authors[].names

// v1:
[null]

// v2021-03-25:
[
  [
    "MH",
    "Holm",
  ],
  [
    "Bob"
  ]
]

// You can also add an additional `[]` to flatten it completely:

// Query:
*[_type == "book"].authors[].names[]

// v2021-03-25:
[
  "MH",
  "Holm",
  "Bob"
]

Null values are not removed in projections

If you have stored null values in your documents, these are no longer removed in projections.

Override attributes while spreading objects and arrays (...)

You can now override attributes while using the spread operator (...).

// Data
[{"title": "A", "customTitle": "B", "_type": "post"}]

// Query:
*[_type == "post"]{..., "title": customTitle}

// Output from v1: 
[{"title": "A"}]

// Output from v2021-03-25:
[{"title": "B"}]

All numbers are float64

All numbers are now 64-bit floats. Previously we used 64-bit integer representation in certain contexts.

String ordering is more consistent

Previously ordering by strings would in some context use a "smart" numeric ordering instead of proper string comparison:

// Query:
["foo4", "foo12"]|order(@)

// v1:
["foo4", "foo12"]

// v2021-03-25:
["foo12", "foo4"]

// However, *|order(foo) has always (both before and after) used proper string comparison.

Deprecated: The is prefix operator

The is operator has been deprecated. You can use the equivalent comparison instead:

// v1:
*[_type is "post"]

// v2021-03-25:
*[_type == "post"]

Deprecated: Function calls without parentheses

Previously you could call functions without parentheses: *[length "foo" > 3]. This is now no longer possible and is a syntax error. You should use *[length(foo) > 3] instead.

Deprecated: $now and $identity

You can use now() and identity() instead.

Projections only work on objects, and returns null otherwise

Whenever you apply the projection operator ({}) on a non-object then it returns null instead of executing the object expression.

This means that the following query *[foo == bar][0]{a} now correctly returns null if there were no results. Previously this returned {}.

Negative indexes are respected in slicing

Previously negative indexes were not respected: [_type == "article"][-1] was equivalent to [_type == "article"][1]. This has now been fixed and -1 returns the last document.

Creating an empty attribute is now an error

The following query now fails: *[_type == "bar" && @[""] == "bar"] since empty attribute keys are not allowed.

order() only works on arrays, and returns null otherwise

Passing | order(…) on non-arrays return a null value instead of converting it to an array.

defined()

defined(x) is now only false when x is null. Previously it was false for empty arrays and objects as well.

Pipe operator works in fewer situations

The pipe operator (|) used to work between nearly all access operators, filters, and slices (e.g., * | [filter], * | (foo), * | [2..4], and * | [2] were all permitted). The pipe operator remains required before the score() and order() pipe functions, and is optional before a projection, but using one before a filter or traversal syntax will throw an error.

New features for GROQ

Namespaces

Namespaces allow for a stronger grouping of functionality within the GROQ specification. They create dedicated spaces for global functions, as well as safer distinctions for specific implementations of GROQ. Learn more.

New functions: score() and boost()

The score() function computes a _score for each document from how well the expression matches the document. The documents will also be sorted by score (from high to low) if no other order() function is specified. Note that all documents will be scored (even those that don't match it at all) so you typically want to add a limit. Read more about scoring and boosting.

Portable Text to plain-text: pt::text()

The pt::text() function takes either a Portable Text block or an array of blocks and returns a string in which blocks are appended with a double newline character (\n\n). Text spans within a block are appended without space or newline. Read more about getting plain text from Portable Text.

New functions for geospatial queries

The geo namespace contains a number of useful functions for creating and querying against locations in your data. Query for distance, intersections, and more.

Performance improvements

Ordering and filtering on date times

It's now possible to filter and order efficiently on date times:

// Filter
*[_type == "post" && dateTime(publishedAt) > dateTime("2021-01-01T12:00:00")]

// Order
*[_type == "post"]|order(dateTime(publishedAt) desc)

Projections on huge documents

If you have huge documents, but your queries have projections that filter away most of the data (e.g., *[_type == "post"]{title, description}) you may see performance improvements.

Expressions with mixed && and ||

Expressions that use both && and || will now often be much faster (depending on how complicated they are).

*[
  _type == "post" &&
  slug == "hello" &&
  ("news" in tags || products[0].name == "Sanity")
]

// v1: Slow!
// v2021-03-25: Much faster!

Version released on: March 25, 2021

Bug fixes

Content Lake v2021-03-25

The following bugfixes has been put into production:

  • Make listeners work in v2021-03-25
  • Fix bug where it was possible to change the _id of a document.
  • Fix bug which prevented datasets to be deleted

Version released on: March 25, 2021

Bug fixes in GROQ implementation

GROQ v2021-03-25

This release fixes smaller bugs for GROQ v2021-03-25.

  • Fixes a bug where dereferencing inside sliced arrays (e.g. *[_type == "book"]{"authors": authors[0...2]{era->}}) would return incorrect result.
  • Fixes a bug where scoping was incorrect while dereferencing arrays: *[_type == "book"]{"authors": authors[]->{..., "bookName": ^.name}}
  • select now produces a query error when given invalid arguments. Examples of invalid arguments are select(title, title2) (multiple fallback values) and select(title, isGood => title2) (alternatives after the fallback)

Articles affected by this release

Version released on: March 25, 2021

New GROQ functions and versioning

Content Lake v2021-03-25

This release targeting v2021-03-25 and v2021-10-21 of the Content Lake brings several new function namespaces to GROQ, as well as introduces the first formalized version of the GROQ language specification.

New GROQ functions

There are three new namespaces for functions added to the specification, which have been implemented across all GROQ tooling. These are:

array:: functions: Perform array operations on lists, such as removing all null values, building text strings from a list of names, or generating a list of all unique document _types.

  • array::compact(<array>) - removes all null values from an array
  • array::join(<array>, <token>) - concatenates all array elements into one string, separated by a specified token.
  • array::unique(<array>) - removes duplicate values from an array (this works for values that can be compared for equality, specifically numbers, strings, booleans, and null, and will not work for values that are arrays or objects)

math:: functions: Run common mathematical operators on numeric values. For example, you can add the prices across multiple products or return the maximum discount available within a cart of products.

  • math::avg(<array-of-numbers>) - calculates the average value (arithmetic mean) of an array of numbers.
  • math::max(<array-of-numbers>) - returns the largest numeric value of an array of numbers.
  • math::min(<array-of-numbers>) - returns the smallest numeric value of an array of numbers.
  • math::sum(<array-of-numbers>) - calculates the sum of an array of numbers.

string:: functions: Manipulate text or validate that information matches a given prefix. For example, get a list of the articles that start with “How to” or split a comma-separated string of author names into an array.

  • string::split(<string>, <delimiter-token>) - turns a string into an array of substrings based on a delimiting token.
  • string::startsWith(<string>, <string-pattern>) - checks if a prefix string exactly matches the start of another string.

To learn all about the new GROQ functions, read the developer update accompanying this release, and visit our documentation.

GROQ1.revision1

With this release, we are also pleased to announce the formal language specification of GROQ, as well as a new versioning scheme. Taking inspiration from other well-known language specs, like HTML and SQL, we settled on the following format:

GROQ-<major version #>.revision<#>

The current version of the specification is GROQ-1.revision1. This version does not include any breaking changes. To learn more about the history and future of the GROQ language, read the blog post from Co-founder and CTO Simen Svale Skogsrud: Content is Queryable: (Re)Introducing GROQ.

Articles affected by this release

Version released on: March 25, 2021

Revamped Date and DateTime inputs

Studio v2.6.3

This release includes a ground-up rewrite of the default Date and DateTime inputs in the Sanity Studio. The new date inputs are powered by Sanity UI and come with improved keyboard accessibility and fewer bugs.

Before
After

Articles affected by this release

Version released on: March 17, 2021

Gatsby Source Plugin: v3 compability, Gatsby Image support, and bugfixes for preview

Gatsby source plugin v7.0.0

Breaking changes in v7.x

Starting at v7.0.0, this plugin requires Gatsby v3 and no longer supports Gatsby v2 or earlier. See the migration guide for instructions on how to upgrade to v7 of this plugin. If you're not yet ready to upgrade to Gatsby v3 we recommend staying at v6.x of this plugin.

Version released on: March 17, 2021

GraphQL generation 3 schema

GraphQL v2020-12-07

Breaking changes between gen2 and gen3

The third generation of the GraphQL API adds support for querying all documents through the new allDocument type. However, with a new generation comes breaking changes.

We had to rename a type to avoid conflicts. DocumentFilter has been renamed to Sanity_DocumentFilter. In other words, if you for example have a query like this:

query GetAllUser($docFilter: Sanity_DocumentFilter) {
  allUser(_: $docFilter) {
    _id
  }
}

It should now look like this in gen3:

query GetAllUser($docFilter: DocumentFilter) {
  allUser(_: $docFilter) {
    _id
    
  }
}

Articles affected by this release

Version released on: December 07, 2020

GraphQL Generation 2 schema

GraphQL v2020-02-27

Deploying generation 1

In order to use the old beta version of the GraphQL API, you can specify it when running the GraphQL command from the CLI. We call these older versions generations. The beta generation is named gen1, and the current generation is named gen2.

To deploy the old generation (beta), you can use the --generation flag in the CLI like this:

sanity graphql deploy --generation gen1

Breaking changes between gen1 and gen2

The second generation of the GraphQL API has more features, and does not pluralize the top-level collection types:

  • Generation 1: post, allPosts
  • Generation 2: post, allPost

The CLI will warn you if there are breaking changes to the schema you deploy and show you where they are. The breaking changes prompt can be disabled by running the deploy command with the --force flag.

Articles affected by this release

Version released on: February 27, 2020