Structured Content 101: Find out how to make your content work harder (without your team working harder) →

Changelog

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