API Changelog
2022-04-07
2023-09-15
To install and initiate a new Sanity Studio without installing the Sanity CLI globally, run the following command in the terminal:
npm create sanity@latest
To upgrade an existing instance to Sanity Studio v3, run the following commands in the terminal:
# Go to the root folder of the installed Sanity Studio instance cd /sanity-studio/root-folder # Upgrade Studio to v3 npm install sanity@latest
๐ข This release: 3.16.7
In a nutshell:
- Blocks only accept objects as members.
- Easier navigation in Sanity Studio.
- Import concurrency increase for faster dataset import.
Previously, blocks also accepted non-object types as members. From this release, it's no longer possible to use primitive types as members of a block. Members of a block must be object-like type.
In this release, we improved the navigation inside the studio by updating the
<title>
element to make it more specific to the current route every time a user navigates in the studio. This makes it easier to browse documents and switch tools.Past versions encountered challenges with concurrent operations during parallel reference strengthening. This issue was addressed in a past release. This release enhances import performance by further optimizing the parallel strengthening of references. The concurrency improvement boosts import performance significantly.
- Simplified managing reference publishing icons by adding aria-labels for accessibility.
- Fixes a visibility issue related to breadcrumbing in the review changes section. Breadcrumbs are now consistent with the new breadcrumb styling.
- Fixes an issue where dialogs wouldn't correctly appear at smaller breakpoints.
- Fixes a minor issue affecting restoring document history in the studio desk tool with multiple nested panes.
- Fixes an issue in the studio desk tool using the index as a key instead of the path when handling multiple validation errors for the same field/node.
2023-10-31
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
This release adds support for styled-components v6. This is an optional upgrade as we'll continue to support v5 during the lifecycle of Sanity Studio v3.
- Fixes a bug where pasting HTML lists into the Portable Text Input would disregard schema configuration for list blocks.
- Fixes an issue where logos of custom auth providers were missing on login screen.
- Fixes an issue where pasting from Google Docs to the Portable Text editor would apply bold formatting to the pasted content on Windows computers.
- Fixes minor issue causing the annotation toolbar popover to not always display correctly. Fixes a bug where the Portable Text input would capture focus trying to edit an inline object's field named
.text
. - Fixes an issue where certain patches would apply differently in the studio and in Content Lake, leading to the studio UI not reflecting the new values for some fields.
- Fixes an issue where certain remote patches would not cleanly apply in the studio, requiring a reload of the document to see the changes.
- Fixes an issue where using
>=
or<=
JSONMatch filters for patch operations would cause the studio to return error messages and not apply the patch correctly. - Fixes published and edits message in the document list.
2022-04-01
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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.
2022-08-24
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
2023-07-25
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Implements the 'document' creation context in the
document.newDocumentOptions
API - Fixes an issue where exported datasets with cross-dataset references could not be imported to different projects. Note that referenced datasets must exist within same project - otherwise use
--skip-cross-dataset-references
. - Removes warning about missing titles for schema types (titles are automatically created based on schema type name - a title is only necessary if the automatic name is incorrect/inaccurate)
- Titles are now automatically applied to field groups and fieldsets, in the same way as with schema types
- Improves error messages from configuration errors
- Boolean inputs will now show validation errors at the input level
- Fixes alignment/scrolling issues of references in delete/unpublish dialog
- Fixes accessibility issues in tooltip text color contrast
- Fixes various accessibility label issues in the desk tool
- Fixes issue where focus would jump to first element when hovering divider in menu
- Fixes an issue where the fallback editor had the title "Editor", instead of the name of the document being edited
- Implements the 'document' creation context in the
2021-11-16
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
.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.
- Allows plan selection with
sanity init --project-plan <plan>
- Improves usability of
ValidationError
by makingcloneWithMessage
optional
2024-04-16
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
In most cases upgrading your studio is as straight-forward as installing the latest version:
npm install sanity@latest
For more information, visit the article on upgrading Sanity Studio in the docs.
If you are upgrading from a version earlier than 3.37.0, you also need to upgrade styled-components and @sanity/ui. To learn more, visit this help article on keeping dependencies up to date.
- Improved global search with better performance and new features.
- Custom styles are now displayed in the Portable Text Editor (PTE) style selector.
We've optimized the search functionality in the Studio for increased performance, especially in workspaces with large schemas. This improvement includes support for wildcard (
*
) and negation (-
) tokens in search queries, allowing for more flexible and powerful search options. This enhanced search feature uses an internal API that is not yet documented for public use.If you need to revert to the previous search behavior for any reason, you can disable the new search functionality by setting
search.enableLegacySearch
totrue
in your configuration.- Fixes tooltip text for the publish button to correctly display "yesterday" without the "ago" suffix when appropriate.
- Fixes a crash in the image hotspot and cropping tool within Next.js embedded Studios.
- Improves focus handling in PTE and the document pane.
- Fixes an edge case where PTE threw exceptions after resizing the validation panel.
- Fixes issue where annotations in PTE would incorrectly retain markup if all fields were null.
- Resolves an issue where custom sort orders, or sort orders in lists that are not
documentTypeList
s, would send invalid requests to the persistent user settings backend. - Fixes regression that hid tool buttons when Sanity Studio was embedded in Next.js applications.
- Fixes a bug where the caret was not visible on code-formatted text within the PTE when using the dark scheme.
- Fixes an issue where the component for custom PTE styles was not being rendered in the style selector.
- Fixes an issue where copying strikethrough text from a google doc would remove the strikethrough once pasted in the PTE.
2023-11-14
To install and initiate a new Sanity Studio without installing the Sanity CLI globally, run the following command in the terminal:
npm create sanity@latest
To upgrade an existing instance to Sanity Studio v3, run the following commands in the terminal:
# Go to the root folder of the installed Sanity Studio instance cd /sanity-studio/root-folder # Upgrade Studio to v3 npm install sanity@latest
๐ข This release: 3.19.3
- Makes field actions keyboard-accessible:
- Enables pressing the
Esc
(Escape) key to discard a comment. - Fixes an issue where hovering over field actions (for example: Comments, AI Assist) when they're not visible would cause them to flicker.
- Enables pressing the
- Fixes an issue where nested Portable Editor input fieldsโPortable Text input inside an object that is inside another Portable Text inputโwould occasionally behave unexpectedly.
- When importing and exporting datasets with the
import dataset
andexport dataset
CLI commands, the output message includes information about theprojectId
and thedataset
in question.
Example:
- Makes field actions keyboard-accessible:
2021-09-01
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).
2023-08-02
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Various microcopy improvements
- Adds
isSlug()
method to@sanity/types
for type-safe asserting of a slug object - Fixes an issue where using multiple desk tools in the same studio would cause duplicate "review changes" actions and validation lists to appear. Thanks @andparsons!
userHasRole
will now acceptnull
as well as a user object, making it more convenient in certain situations where the user might not yet be accessible- Fixes issue with auto scrolling on collapsed fieldset
- Fixes issue where array list would not display all items when wrapped in a custom element
- Fixes issue where array list would not display when inside a popover
2021-11-02
Fixes a regression introduced in #2884 that caused the saving spinner to not appear while a change was still syncing
2022-03-03
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
- Fixes a number of issues with the
2022-03-30
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
Allow selecting an organization to attach new projects to during
sanity init
.- 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)
- 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.
2021-12-02
Fixes a bug that disabled all options in the global 'create document'-menu due to insufficient permissions.
2021-04-13
- Bring back the
gatsbyImageData
on image nodes - Set more specific peer dependencies and engines update
- Bring back the
2021-08-25
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: [/* ... */], }, ], }
Get more code examples and read more about the details in our docs.
2023-06-06
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
Adds support for block, inlineBlock and annotation form components. You can now write plugins or create workspace configuration that change how these types are rendered in the studio. (Documentation forthcoming)
- Fixes a regression that broke document-level readOnly
- Fixes a bug that caused conditional field callbacks inside fieldsets to get passed a wrong parent value
- Improves deep linking to the Portable Text Input for visual editing
- Fixes an issue where
@sanity/block-tools
would remove whitespace from<pre>
tags - Fixes an issue that could sometimes cause newly inserted array items to be immediately removed
2024-05-14
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
You can now conveniently save the results of your Sanity Vision queries as JSON or CSV files. Simply run your query and click on the new "save result as" buttons in the bottom right corner.
Custom components included in the Structure Builder (like
S.component(MyCustomComponent)
) can now handle intents. This is especially useful for routing to custom components from global search results or other links. You can achieve this by using thecanHandleIntent
parameter.S.listItem() .id('translate') .title('Translate Test') .child(S.component(TranslateExample).id('example') .canHandleIntent((intent, params, context) => { console.log(intent, params, context) return true } ))
- Fixes an issue where Boolean inputs were not always clearly indicated as read-only and disabled.
- Makes the search/filter in the document "Inspect" dialog case-insensitive.
- Prevents inputs within the Portable Text Editor from calling
element.onFocus()
on any opened block or inline-object, thus avoiding unintended modal closures. - Prevents extra work on preview prepare functions, ensuring better performance.
- Fixes miscellaneous bugs and performance issues with Portable Text Editor's block extras and highlight rendering. For example, pointer events are now correctly disabled to avoid unnecessary cursor changes or rendering thrashes.
- Fixes an issue where the document history panel would appear to load indefinitely
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
- Resolves a
Maximum update depth exceeded
crash in Presentation Tool.
- Resolves a
2023-03-08
โ ๏ธย 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.
Upgrade the v2 version of the Command Line Interface (CLI) with:
npm install --global @sanity/cli@v2
Upgrade Sanity Studio with:
sanity upgrade
- 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
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
2022-08-29
2022-04-26
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
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
2021-03-29
Most changes in this version are improvements and bug fixes behind the scenes โ however there are a few new APIs:
- Introduced the
onItemSelect
property ((index: number) => void
) to theMenu
component props, to make it possible to subscribe to whichMenuButton
is currently selected. - The
MenuItem
now takes theselected
property (boolean
) to indicate which item in aMenu
should be selected by default. - The
MenuButton
component now takes thepopover
property (PopoverProps
), which is an object containing properties for thePopover
component (likearrow
,preventOverflow
,portal
, and so on). - The
Popover
component now takes amatchReferenceWidth
property (boolean
) to render the popover with same width as the referred element.
- Introduced the
2021-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 tofoo * bar
, because.
would be considered a word-splitting character, and sofoo.*bar
would never match the stringfoo.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 returningContent-Type: text/plain
even though they were streaming JSON. After this version they returnContent-Type: application/x-ndjson
instead.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
2021-05-13
The first version of
next-sanity
shipped with thepicosanity
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. Sincepicosanity
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.
2021-10-06
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.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.
- 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
- fix(language-filter): fixes popover placement issue when language list is long (#2801)
- Newly initialized studios will now include a
2023-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.
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.
2022-08-05
Upgrade Sanity Studio with:
sanity upgrade
- 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
2023-05-26
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
Disables the new search API introduced in v3.38.0 due to a few discovered issues. We'll re-enable it in a future release.
2022-09-14
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
2024-03-21
2023-02-08
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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).- 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
- Disables sorting of array items when
2023-12-12
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes virtualization issue which caused array items to erroneously be hidden when navigating between groups inside a modal
- Fixes Portable Text Editor in expanded mode not closing when switching tabs/views
- Fixes date/datetime inputs and date search filters showing incorrect weekday in the calendar
2022-01-26
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 onassets.upload
was removed. client.observable.fetch()
returns a cold observable.
- The client will now fetch from the API CDN when a token and
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
Adds filtering by name, email and roles in project members list
2023-06-27
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- New Document inspector
@beta
ย API - Document validation now opens in a sidepanel
- Improves behavior of popovers in the Portable Text editor
sanity debug
now outputs all the roles of the currently authenticated user
- New Document inspector
2022-05-31
Upgrade Sanity Studio with:
sanity upgrade
- 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
2024-03-28
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes an issue where clicking "Publish" and possible other actions would throw the error
Sanity LocaleContext value missing
. - Fixes an issue in which users' names were sometimes displayed in lowercase in the tasks assignee list.
- Fixes an issue where clicking "Publish" and possible other actions would throw the error
2022-03-13
Added a new point of presence for our APICDN in Mumbai, India.
2023-06-14
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes a issue where documents wasn't locked while a document was being synced
- Fixes a bug where certain references would result in invalid GraphQL union types (thanks @james2doyle!)
2024-01-30
To initiate a new Sanity Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latest
You can now create, list, and run content migrations from the Sanity CLI. The new tooling lets you scaffold content migrations as code and run them in dry and production mode. It also introduces a new API for defining content migration with helper functions (
defineMigration()
).You can explore the documentation for schema and content migrations; or learn more by running the following CLI commands in a Sanity Studio project folder:
sanity migration --help
You can run
sanity migration create
to explore our new content migration templates.You can now validate a Sanity Studio schema with the CLI command
sanity schema validate
. Among other things, it will identify problems with your schema-type definitions. This tooling can be useful for running in CI/CD pipelines or debugging your schema configuration.Learn more by running:
sanity schema validate ---help
- Adds Studio UI localization support to the comments plugin
- Adds support for validating dataset import and export files with
sanity documents validate
- Adds
intentUrl
injson
andndjson
formats forsanity documents validate
2023-12-07
2022-01-04
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
- It now respects the version ranges and pinned versions declared in your
2021-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.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 } }
GROQ now uses three-valued logic consistently:
>
,>=
,<
,<=
returnsnull
when the operands are of different types.&&
,||
handlesnull
"as expected":null && true
โnull
andnull || true
โtrue
.
Note that
==
has changed slightly:- It now always return either
true
orfalse
(nevernull
). - You can compare against
null
and get the expected result:123 == null
โfalse
andnull == null
โtrue
. - Comparisons between other types than strings/booleans/numbers always return
false
.
This also means that
in
works withnull
:null in foo
will returntrue
iffoo
is[null, 1, 2]
.in null
always returnsnull
.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 inv2021-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" ]
If you have stored
null
values in your documents, these are no longer removed in projections.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 now 64-bit floats. Previously we used 64-bit integer representation in certain contexts.
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.
The
is
operator has been deprecated. You can use the equivalent comparison instead:// v1: *[_type is "post"] // v2021-03-25: *[_type == "post"]
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.You can use
now()
andidentity()
instead.Whenever you apply the projection operator (
{}
) on a non-object then it returnsnull
instead of executing the object expression.This means that the following query
*[foo == bar][0]{a}
now correctly returnsnull
if there were no results. Previously this returned{}
.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.The following query now fails:
*[_type == "bar" && @[""] == "bar"]
since empty attribute keys are not allowed.Passing
| order(โฆ)
on non-arrays return a null value instead of converting it to an array.defined(x)
is now only false whenx
isnull
. Previously it was false for empty arrays and objects as well.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 thescore()
andorder()
pipe functions, and is optional before a projection, but using one before a filter or traversal syntax will throw an error.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.
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 otherorder()
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.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.The
geo
namespace contains a number of useful functions for creating and querying against locations in your data. Query for distance, intersections, and more.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)
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 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!
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
- Make listeners work in
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 areselect(title, title2)
(multiple fallback values) andselect(title, isGood => title2)
(alternatives after the fallback)
- Fixes a bug where dereferencing inside sliced arrays (e.g.
This release targeting
v2021-03-25
andv2021-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.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 allnull
values from an arrayarray::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, andnull
, 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.
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.We've identified and fixed a bug where a GROQ OR-filter inside a subquery would some times return too many results.
2021-10-08
- 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.
2022-10-12
2022-11-15
2022-08-04
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
- 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:
2021-10-14
- 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 initialnull
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
2024-04-03
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes an issue in the Portable Text editor in which annotations were not opening (bug introduced in v3.36.3)
- Fixes a potential cross-origin error from being shown in the developer console
2023-01-11
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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
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.
- Reintroduces some flags for
sanity graphql deploy
. Note that flags will apply to all configured GraphQL APIs.
- 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 usingRule.valueOfField()
- thanks @fritz-c - Adds schema validation error when defining already defined field names for image and file types
- Supports Node ESM (>=14)
- Reintroduces some flags for
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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
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.
- Reintroduces some flags for
sanity graphql deploy
. Note that flags will apply to all configured GraphQL APIs.
- 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 usingRule.valueOfField()
- thanks @fritz-c - Adds schema validation error when defining already defined field names for image and file types
- Supports Node ESM (>=14)
- Reintroduces some flags for
2022-08-15
2020-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 } }
2023-03-01
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
anddatetime
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
- Fixes an issue where the
2021-12-08
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 propertydisableNew: true
.More:
The ability to define if a field is editable based on conditions defined in a schema.
In addition to being able to provide validation errors, developers can also provide guidance with โน๏ธ -symbols to give in-line help to editors.
The Portable Text editor now supports a new
modal
option with atype
andwidth
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.
- Fixes a case where the
2021-12-14
- 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 anndjson
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
- Added support for HTTP proxies when using dataset
import
/export
commands - Validation menu button now reflects the highest level of validation
- Fixes an issue where previews of a reference to a document with a field named
2023-03-28
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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.
- 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
2022-02-22
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- Adds keyboard arrow navigation in the Portable Text Editor toolbar (#3126)
- 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)
2022-10-28
2022-12-07
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.
- 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
2021-11-17
Fixes an issue where some custom styles implementations for the Portable Text Editor caused an error.
2024-03-20
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Increases width of all inline popovers in the Portable Text Editor
- Fixes an issue where incorrect studio version was shown in the help menu
- Fixes an issue where incorrect loading message shown while a pane is resolving in the structure tool
2021-09-13
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 thatreact
andreact-dom
is.The first time you run
sanity start
,sanity build
orsanity 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.
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.- 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
- Fixes a rare case where an error could be thrown during the React render lifecycle without being an
Login screens are refactored to use Sanity UI.
2023-11-02
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Adds v2022-03-08 to list of predefined API versions in the Vision plugin
- Hotkeys are now displayed using platform-aware keys (eg
Opt
instead ofAlt
on Mac)
- Fixes an issue where references would not open in-place, instead yielding an error about being changed after opening
2024-02-13
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes an issue where the alert messages for published or deleted documents sometimes displayed incorrect titles
- Fixes a comments-related error dialog from inadvertently showing up to users
- Removes layout shift when loading document locations when the Presentation tool is used (#5702)
- Fixes a bug that hid unpublished documents in "Documents on this page" in the Presentation tool (#5702)
- Fixes a bug that caused the document pane to stay open in the Presentation tool (#5702)
- Adds support for importing system documents via
--allow-system-documents
for dataset imports - Adds support for parameterized templates in the Presentation tool (#5694)
Sanity AI Assist 2.0 comes with new features and breaking changes that bring consistency to the plugin's configuration.
Paid feature
This article is about a feature currently available for all projects on the Growth plan and up.
To upgrade to the latest version of AI Assist:
npm i sanity@latest @sanity/assist@latest
Sanity AI Assist can now translate localized content with a simple action. Built to support the localization models used by the Document Internationalization and Internationalized Array plugins.
You can now instruct AI Assist to generate images for image fields. It also supports a two-step process where you instruct AI Assist to generate an instruction for image generation for better results.
AI Assist can now add image descriptions to an image field. This is useful for generating alternative text and image captions. AI Assist will automatically run when an image is uploaded and replaced.
AI Assist can now work with reference fields to pull in content that's described in an instruction. Requires setting up an Embeddings Index for documents you wish to refer to.
- You can now explicitly filter what fields an instruction is allowed to interact with
- Support for conditionally
hidden
andreadOnly
fields - Image generation instruction will always show when enabled
- Translation actions will be disabled if AI Assist is not initialized
- AI context blocks are now always visible in the instruction editor
AI Assist's schema option properties have changed and been moved into a common namespace (
aiAssist
). Some configuration properties have been renamed for clarity.All AI Assist schema options now live under
options.aiAssist
:options.aiWritingAssistance.exclude
->options.aiAssist.exclude
options.aiWritingAssistance.embeddingsIndex options.aiAssist.embeddingsIndex
options.aiWritingAssistance.translateAction
->options.aiAssist.translateAction
options.imagePromptField
->options.aiAssist.imageInstructionField
options.captionField
2023-07-11
- Fixes an issue where the
styled-components
dependency would not be installed when installing Sanity in an existing project - Fixes an issue where the "Restore" document action would sometimes not restore the document
- Fixed an issue where the fallback editor had the title "Editor", instead of the name of the document being edited
- Fixes an issue where the
2023-02-21
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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 throughprocess.env.SANITY_STUDIO_...
. While they are theoretically also available underimport.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
andsanity deploy
will use theproduction
mode, while all other commands will default to thedevelopment
mode.- Setting
NODE_ENV
toproduction
will set the mode toproduction
, but setting it to other values (such astest
) will not change the mode. - To use a custom mode, you can set the
SANITY_ACTIVE_ENV
environment variable. - Both
NODE_ENV
andSANITY_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.
- Setting
- 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 yoursanity.cli.ts
/sanity.config.ts
files. Make sure you useprocess.env
and notimport.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
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 fromsanity/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 anenvFile
option:import {getStudioEnvironmentVariables} from 'sanity/cli' console.log( getStudioEnvironmentVariables({ envFile: { mode: 'production', envDir: '/path/to/some-dotenv-root' } }) )
- Fixes an issue where generation 1 GraphQL APIs would have changed pluralization rules for types ending with a number.
- All environment variables with the
2023-05-17
2024-03-27
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes an issue where the studio might crash on "orphaned marks" in the Portable Text Editor.
- Fixes an issue that caused the tasks plugin to be inserted multiple times in studios using more than one instance of the Structure Tool.
2024-01-10
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
Legacy themes for Sanity Studio will now handle custom colors without losing the scaffolding provided by the default studio theme. This improvement means that the custom colors you define will no longer revert to default values, but instead integrate seamlessly with Sanity Studio.
A new flag
__experimental_formPreviewTitle
has been introduced, allowing you to hide the large preview title displayed in the document pane form. This grants more control to users with custom implementations that do not benefit from this title being displayed.import {defineType} from 'sanity' export const playlistType = defineType({ name: 'playlist', type: 'document', // ๐๐๐ __experimental_formPreviewTitle: false, // ๐๐๐ // ... })
The comments feature within Sanity Studio is now enabled by default, embracing collaboration and social interactions on your documents right out of the box.
The import path for the structure tool has been updated. Developers should now import from
sanity/structure
instead ofsanity/desk
. A helpful codemod is available to facilitate the migration of any existing code. Existing imports tosanity/desk
will still work but those imports have been marked as deprecated and will be removed in a later major version.A codemod is available to migrate any code that may be using it:
npx @sanity/cli codemod deskRename
Be sure to check in any local changes to version control before running the codemod in case it should fail.
A new opt-in cache,
--with-union-cache
, improves GraphQL schema generation speed by up to 95% for schemas with numerous self-referencing documents. This optimization is essential for larger projects and significantly improves the deploy experience.- Fixes a regression where custom document action modal dialogs were not rendering footer content correctly.
- Resolves issues related to incorrect default locale strings, ensuring the restoration process of document revisions is accompanied by proper messaging.
- Fixes problems with the strike-through formatting when pasting content from Google Docs.
- Corrects font weight rendering issues on iOS16, ensuring consistent visual experience across platforms.
- Fixes the improper alignment of button text in the Portable Text Editor to match standard UI practices.
- Ensures annotation toolbar popover in PTE follows the correct element on scroll, enhancing usability.
- Fixes fieldset border issues in forms for a cleaner UI presentation.
- Resolves console warnings stemming from passing non-DOM properties to styled-components.
- Updates navbar button positions for better user discoverability and accessibility by adding aria labels to expand buttons in PTE.
2021-03-17T14:29:00.000Z
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.
2024-01-23
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
This release introduces the option to mark document and field types as deprecated. This can be used to gently steer Studio users towards updated schemas or to phase out legacy fields without abrupt changes.
export const deprecatedDocument = defineType({ name: 'deprecatedDocument', title: 'Deprecated Document', type: 'document', deprecated: { reason: 'Use the Author document type instead', }, fields: [ defineField({ name: 'title', type: 'string', deprecated: { reason: 'This field was used in a legacy system and is no longer used.', }, }), ], })
When a field or document is deprecated, an informative message will appear in the Studio, clearly indicating the recommended action to take. This aids in maintaining a clean and up-to-date content structure.
Bonus: Deprecation messages now appear in the GraphQL schema, providing clarity during transitions. Deprecated document types and fields should be appropriately treated in documentation and tooling.
This release also introduces a new layer of interactivity in the Studio with the ability for users to react to comments! ๐
Far be it from us to speak ill of verbose and precise communication using full sentences, but sometimes you just want to express a sentiment quickly with a ๐ or a ๐ and Sanity Studio now has you covered for those occasions. Streamline feedback processes and consensus building, and make your Studio a more vibrant collaborative space in one fell swoop with comment reactions. ๐ฉ
- Enhances user experience in the Studio by adding localized browser document titles and correcting unlocalized strings, accommodating users who prefer languages other than English.
- Fixes an issue where number-like string flags passed to CLI commands were parsed as numbers by the option parser, leading to truncation of large integer-only document IDs and similar.
- Resolves a restoration issue with the
token
login method ensuring the active session is retained post webpage reloads when cookieless auth is in effect. - Enhances UI components consistency in tooltips and delay groups for better UX.
- Fixes a performance issue by re-applying
useMemo
onDocumentPaneContext
values, reducing unnecessary re-renders and improving document pane performances. - Ensures that errors in the
useFeatureEnabled
hook result in an empty features list rather than disruptive error toasts; this minimizes user interruption when feature availability checks fail. - Fixes multiple bugs in the
sanity documents validate
CLI command relating to visibility, unnecessary validation reports, reference checks batch processing, and unknown field validation for images and file types. - Improves spacing between the published date and the last updated date in the document status bar for better readability.
2024-02-20
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
With the recent introduction of both Presentation tool and comments, we realised that context can be crucial in understanding comments relating to visual aspects of an application.
Comments created from within the Presentation tool will now display a link allowing content editors to navigate from any tool directly to the context in which that comment was made in their application.
- Improves error handling for a migration script that attempts to iterate over the passed document function without calling it
- Adds new Studio API,
ActiveToolLayout
, which allows plugin authors to have more flexibility by wrapping the active tool - The selected viewport in Presentation is now persisted in the URL
- Improves focus handling with the Presentation tool and Portable Text Inputs
- Fixes regression preventing
import {debugSecrets} from '@sanity/preview-url-secret/sanity-plugin-debug-secrets'
listing secrets - Fixes a bug preventing the CLI being used inside Studio project subdirectories
2021-11-30
- Introduces a larger initial
min-width
for theDocumentPane
. - 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 theblock
type.
- Introduces a larger initial
2023-05-03
Initiate a new Sanity Studio without installing the CLI globally:
npm create sanity@latest
To upgrade Sanity Studio, update its dependency:
npm install sanity@latest
Note
Visual Editing is available for select Sanity enterprise customers. If you would like to use Visual Editing with Vercel, you will also need to contact Vercel to enable this feature for your Vercel team. You may contact our sales team for more information.
This release includes support for Visual Editing and Content Source Maps. This feature enables you to make deep edit links from components in a front end that takes you to respective fields in the Studio. This enables a new workflow that substantially reduces the time it takes to make changes by bringing you directly to the relevant field where you can make edits reliably in its appropriate context. For more information on Visual Editing, check out the documentation here.
Visual Editing is available for mutual Sanity and Vercel Enterprise customers. Existing Sanity enterprise customers can contact their dedicated customer success manager to enable this feature. Customers interested in upgrading to an enterprise plan can contact our sales team for more information. You will also need to contact Vercel sales to enable this feature for your Vercel team.
Sanity enterprise customers can also use the Content Source Maps with GROQ to build custom Visual Editing capabilities. For more information, check out the Content Source Maps documentation here.
The
sanity init
ย command now recognizes if you are in a Next.js project, and will ask:- What Sanity project you want to use (use existing or create new)
- Whether you want to place an embedded Studio using pages or app routes
- Whether you want to use TypeScript for your Studio
- What template you want to use (clean or blog)
- Whether you want to append the project ID and dataset to your .env file (you can also specify a custom env file with the --env flag)
If you have a Next.js project and want to quickly deploy an embedded Sanity Studio, you can run
npx sanity init
within your application's directory to get started.Minimum version when using pnpm required: 8.x
- Enables fully unattended
studio init
with CLI whenprojectId
,dataset
and--y
flags are set sanity init
will now determine default package manager choice based on currently running package manager
- Updates the Shopify Studio template with various fixes
- Fixes an issue that caused field group buttons to steal focus when deep linking into a Studio value
- Fixes an issue causing focus to be set on wrong element when deep linking to a field inside an array
- Fixes an issue so deep linking to a field/input expands the right fieldsets/collapsed objects along the way
- Fixes an issue where validation errors would not focus on collapsed fieldset
- Fixes an issue where using
pnpm
to install dependencies would not install the latest available versions when creating a new project - Resolves issue where unattended mode (
--yes
flag) forsanity init
would still show a confirmation prompt about running a v2-like CLI command - Fixes a bug with reference fields not receiving focus when clicking a validation error or following a link to the field
- Fixes intent links to focus on the correct location
- Fixes issue with pasting a file from clipboard into a file field that already has a value
- Fixes support for deep linking in image and file fields
- Fixes a bug that broke pasting a file into a file field when a value is already present
2022-01-19
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
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
New projects bootstrapped with the CLI will now contain a default
.eslintrc
that extends our new shared ESLint config @sanity/eslint-config-studio.- 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
andsanity debug
would fail if running without any dependencies installed. - Removed third party dependency causing security warnings with
npm audit
(immer.js
)
2022-04-29
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
2023-01-12
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
2022-03-16
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
The Studio now has a new changelog dialog that features more in-depth information about the latest features and bugfixes.
- Fixes an issue in array inputs where the input was disabled when dragging items within a Portable Text Editor
2023-12-19
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
The Translate the studio UI #1603 issue has been one of our most popular feature requests on GitHub. Now we can finally close it, because we have launched Studio UI localization.
- Multilingual support: You can now configure the Sanity Studio user interface to use languages other than English. We're starting with many languages, including Spanish, French, Norwegian, German, Portuguese, Korean, Turkish, Icelandic, Thai, Vietnamese, Swedish, Finnish, Czech, Italian, Japanese, Chinese, and Polish. Donโt see your preferred language? It's easy to request additional language plugins!
- AI-Translated language plugins: These initial translations are generated by AI โ we're inviting the community (thatโs you!) to help us improve and maintain these translations for accuracy and cultural relevance. Interested? Read more about how to contribute over on GitHub.
This is our first step towards a fully global studio. The support for localization will grow, starting with our official plugins. We appreciate your patience and contributions as we expand these capabilities!
- Choose your language: Visit github.com/sanity-io/locales to find the plugin for your desired language. If it's not listed, weโd love you to request it - we can do a first auto-translated pass, and you can help us review and improve the automated translations.
- Plugin setup:
- Ensure you are using Sanity version
3.22.0
or newer - Install the plugin for your desired language (
npm install @sanity/locale-nb-no
) - Import it (
import {nbNOLocale} from @sanity/locale-nb-no
- Add it to your studio's plugins array (
plugins: [nbNOLocale()]
) - Youโll find full instructions on the locale pluginโs README!
- Ensure you are using Sanity version
- Documentation:
We're eager to hear from you and welcome any feedback. This is just the beginning, and your insights are invaluable in making Sanity Studio even better.
As a product company, we have to prioritize what to work on. Ideally, those decisions are based on a healthy amount of vision (how we think things could be better) and insight (how people use the product). We have had a good amount of the former but less of the latter.
With this release, weโre introducing telemetry data collection in the CLI and Studio. Participation is optional, and you can easily opt-out by running
npx sanity telemetry disable
, setting the DO_NOT_TRACK=1 environment variable, or visiting Account Settings in Manage. For more details on what data is collected, how itโs being used, and how consent is handled, go to sanity.io/telemetry.- Adds experimental support for using Bun as package manager when creating new Sanity projects (
bun create sanity
) - Adds the ability to customize the suffix added to auto-generated GraphQL filter types (
Filter
by default), by configuringfilterSuffix
in the GraphQL configuration ofsanity.cli.ts
- Fixes issue where annotation popover would open in the wrong location when selecting annotation text in the Portable Text editor
- Fixes removal of marks in the Portable Text editor, not always cleaning up unused mark definitions
- Fixes issue where Portable Text editor would crash when attempting to use annotations on text over multiple blocks
- Fixes issue in which new empty text blocks were added when adding a non-text block in the Portable Text editor
- Fixes an issue where selecting a custom API version in the Vision tool would sometimes crash
- Fixes a minor bug related to event logs introduced in v3.22.0
This update significantly upgrades the Sanity Studio user interface (UI) and Sanity UI. The goal here is to align it with what you expect for modern tooling and reduce elements where possible to make it easier and smoother. We also wanted to bring more consistency in styling and interactivity.
At a high level, we have:
- Updated the navigation bar with fewer visual elements
- Reduced visual noise in document lists and made it easier to discern between documents and folders
- Made typography, line heights, and styling more consistent
- Updated color themes to add more vibrancy where interactive elements need to stand out
- Cleaned up the document form and added a large title to make it easier for editors to discern where they are
- Made dates human readable (exact date time accessible on hover)
- Added simple animations to improve how it feels to use the Studio
- Removed the
components.studio.logo
API to more clearly signpost what workspace you are in (you can still add custom logos with workspace icons) - Done the groundwork to simplify branding and theming the Studio
- Updated Sanity UI with new studio-specific UI components and better support for the new localization features
To install this upgrade (
v3.23.0
) run:npm install sanity@latest
If you have used Sanity UI (
@sanity/ui
) for Studio customization, you should install the beta of the new major release, too.npm install @sanity/ui@beta
We have worked hard to identify edge cases, but this update might break with customizations, and plugins that use and haven't updated their Sanity UI dependency might look a bit out of place. We recommend you test out the upgrade on a branch and preview deployment.
If this upgrade for some reason doesn't work with your current Studio, you can downgrade to
v3.22.0
(and minor patch releases for it). Editpackage.json
and runnpm install
:{ //...rest of package.json "dependencies": { "sanity": "^3.22.x" } }
If you have to do this, tell us what doesn't work for you in an issue on GitHub.
This upgrade changes how the Studio feels and looks; in some cases, it moves affordances that your content team might have used to. We think this upgrade improves the editorial experience, but it is still good to inform your team that this change is coming. And use that opportunity to teach them about keyboard shortcuts like
cmd + K
/ctrl + K
to open the search bar.If you are a plugin maintainer and want to support this upgrade, then you can add
^2.0.0-beta
to the peer-dependency range of@sanity/ui
:{ //...rest of package.json "peerDependencies": { "@sanity/ui": "^1.0 || ^2.0.0-beta" } }
This will make it stay compatible with future stable/non-beta releases of
@sanity/ui@2.x
.This release deprecates some parts of the Studio Customization Framework.
The
studio.components.logo
are no longer rendered. For custom logos, use theicon
property in the workspace configuration instead:// sanity.config.ts import {defineConfig} from 'sanity' import {RobotIcon, RocketIcon} from '@sanity/icons' import {deskTool} from 'sanity/desk' import {schemaTypes} from './schemas' export default defineConfig({ projectId: '<projectId>', dataset: 'production', name: 'Production', title: 'Default Workspace',
icon: RobotIcon,plugins: [deskTool()], schema: { types: schemaTypes, }, })Tool icons are no longer rendered; only the tool name is used in the navigation bar. There is no workaround for this.
The Structure Builder API has allowed for a menu group title to be set. This is no longer displayed.
2023-03-31
2024-03-19
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes an issue that would cause duplicate entries in the list of recent searches.
- Updates the type of
value
withinObjectFieldProps
to accept a type parameter, allowing for dynamically setting the expected type. (thanks @shixish)
2023-10-10
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Responsive improvements to the Vision plugin to accommodate narrower screens
- Updated icon for copy buttons
- Bump
engines.node
to >= 18
Fixes type for
canHandleIntent
to allow passingundefined
Fixes placement of "Add itemโฆ" popover in array inputs
Fixes a bug where edit intent was not called when added to a
menuItem
(thanks @israelroldan ๐)
2022-01-11
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
Added Field Groups to schemas and document view. Read more about the feature here: https://www.sanity.io/docs/field-groups.
Arrays now support adding new items before/after existing array items, and also duplicating existing items.
Updated document status indicator with saving state and animation.
- Added
SANITY_STUDIO_PROJECT_NAME
environment config variable
- 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
- Added
2023-05-25
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Fixes a recent regression from v3.11.2 where text annotations nested inside Portable Text inputs could not be edited properly
2021-11-18
Fixes a bug in Safari where editing annotations (like links) in the portable text editor would make the popover dialog jump around.
2023-08-29
To install and initiate a new Sanity Studio without installing the Sanity CLI globally, run the following command in the terminal:
npm create sanity@latest
To upgrade an existing instance to Sanity Studio v3, run the following commands in the terminal:
# Go to the root folder of the installed Sanity Studio instance cd /sanity-studio/root-folder # Upgrade Studio to v3 npm install sanity@latest
In a nutshell:
- Enhanced Portable Text editing experience.
- Faster syncing.
- Full support for Portable Text on Android devices.
- Offline detection.
Sanity Studio uses the diff-match-patch algorithm to match and patch document changes. In previous versions of the Sanity Studio, the underlying library wouldn't work correctly when parsing some Unicode characters. We addressed those issues in this release.
If you experienced issues when using characters such as emojis, Kanji, or other non-Latin characters, this release resolves these issues.
Besides improved Unicode support, the Portable Text Input and the underlying text editor feature several improvements to provide a smoother editing experience.
Previously, prolonged fast typing in the editor would trigger debouncing: the Portable Text Input would temporarily suspend committing edits until you decreased your typing speed below a specified threshold.
This behavior could produce bigger discrepancies between your local value and the corresponding actual value stored on the server side.Now your changes are committed in a throttled way: the editor commits the changes as you type, without compromising performance.
Undo and redo features have been improved considerably, especially when working with many editors on the same document.
The Portable Text Input is now fully supported on Android. Previously, typing in the editor using an Android on-screen keyboard would cause some issues.
The Portable Text Editor automatically enters read-only mode if it detects that the network is offline.
This behavior helps keep your local document in sync with the corresponding copy on the server when there is no online access, and it prevents losing changes due to not committing them.- The
sanity
module is now marked as free of side effects, which can produce smaller bundle sizes (thanks@mckelveygreg
! ๐) - Improved UX when deleting a document.
- Fixed a bug where changing text styles in the Portable Text Editor would cause the editor to lose focus.
- Fixed a problem that would occur when repeatedly applying and removing text decorators while typing in the Portable Text Input.
- Fixed the odd placement of the โEmptyโ placeholder in the Portable Text Editor on WebKit browsers.
- Fixed a media visibility issue in Safari occurring in list previews with custom SVG elements.
- Fixed the alignment of action items in pane headers on mobile devices.
- Fixed a padding inconsistency in reference fields.
- Fixed a visibility issue affecting tooltips in the navigation bar, and causing them to be displayed behind open menus.
- Fixed an issue impacting cross-dataset reference fields displayed as nested fields, inconsistent with regular reference fields.
- Fixed a bug that caused specifying
apiVersion
ondocumentList()
anddocumentTypeList()
to not work in the desk structure. - Fixed the initial flashes of validation errors for valid content on document load.
2022-09-07
2022-03-23
2023-03-29
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
- Fixes a regression from
2022-02-08
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
Presence, the ability to see where your collaborators are, is now visible in document lists, search results, and reference previews.
- You can now configure the default API version for Vision (#3127)
- 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)
2022-01-27
Upgrade the Command Line Interface (CLI) with:
Comment
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
2022-10-14
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
2023-06-20
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes potential typing issues caused by mismatched versions of
@types/react-is
- Fixes issue where validation tooltips were clipped inside of the Portable Text editor
- Improves accessibility of list panes when using screen readers
- Fixes potential typing issues caused by mismatched versions of
2023-11-28
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Improves the Portable Text Editors backspace handling on text blocks that follows a non-text block
- Fixes an issue where the Portable Text Editor would crash if a block with its
children
property set toundefined
was inserted - Ensures that
StudioLayout
utilizes thecomponents
API when used in isolation - Fixes some performance issues related to entering text into all compatible Studio inputs. Typing in Studio inputs should now be noticably faster, in particular for schema types with a lot of deeply nested fields.
- Adds node.module to package.json which improves compatibility with Webpack, Astro, Svelte and Vue
2021-10-15
- Fixes a bug where the
withDocument
higher-order component would sometimes returnnull
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
- Fixes a bug where the
2021-08-31
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.- Since v2.16.0, (inline) references in Portable Text would not be saved properly and left an arbitrary attribute. This version fixes that.
2023-05-09
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Fixes issue where the Create new document dialog didn't work on smaller screens
- Fixes issue where out of range integers in number fields could crash the studio
2020-02-27
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 namedgen2
.To deploy the old generation (beta), you can use the
--generation
flag in the CLI like this:sanity graphql deploy --generation gen1
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.- Generation 1:
2021-12-17
- 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
2024-01-16
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade Sanity Studio, run this command in its folder:
npm install sanity@latest
The new
sanity documents validate
command is now available! It runs all documents in a dataset against your project's schema in the terminal. It uses a mocked browser environment to validate all documents locally, perfect for ensuring data integrity.Note: This feature is currently in beta, so it might not run correctly for all projects. We encourage users to report any issues encountered to help us improve it.
The Studio now preserves formatting more reliably when content is pasted from Google Docs in Safari, and no longer incorrectly applies underline decorators to pasted links. Additionally, the Studio now preserves formatting more reliably when content is copied from a single block in Notion.
- Root page link: The workspace icon now consistently serves as a direct link to the 'root' page (the first configured tool), streamlining navigation.
- Improved Workspace Switcher: A new tooltip feature has been added to the workspace switcher for better clarity.
- Simplified Tool Menu: The tool menu will now be hidden when only one tool is installed, reducing clutter.
- Layout stability: We've resolved an issue with long workspace titles disrupting the navbar layout. Titles now truncate with ellipses to maintain a clean appearance.
- Localized tooltip text: The 'open menu' button tooltip text has been localized and is now more accessible on smaller screens.
- Intuitive icons: The help and resources button now features the correct icon, making it more intuitive and consistent with previous versions.
- PTE improvements: Ensures that clicking to edit in presentation mode correctly focuses the relevant block, improving the editing workflow.
- Fixes a bug where logging out didn't invalidate the cookieless auth token.
- Fixes an issue in the Portable Text Editor where the 'Empty' placeholder placement was off.
- Fixes an issue where array item focus rings were cropped, ensuring they're now displayed in full.
- Fixes a bug where the workspace switcher tooltip wasn't displaying correctly.
To install or upgrade Sanity UI:
npm install @sanity/ui@latest
This
2.0
release of Sanity UI is a major visual update that introduces:- Updated component styles and defaults
- New color palette changes (via
@sanity/color
) - Optional animation support for
Popover
,Tooltip
andMenuButton
components - Updated font stack (defaulting to Inter, if available) and font metrics
- Various under-the-hood improvements
For plugin authors: you can continue to use Sanity UI
1.x
without issue, though we strongly recommend upgrading to2.x
to ensure visual consistency if you're targeting Sanity Studio3.24.x
and higher.- add
buildTheme
function (b09226e) - add animate support to popovers, add custom origin middleware and animate from reference origin (#1194) (9ee54ba)
- add inter to default (non-code) font stack (23baaa6)
- add radius='full' support and supporting stories (#1150) (e9adb5b)
- allow tooltip arrows to be hidden (22c6f73)
- animations: add animations to dialog and tooltips. (#1187) (6cb872f)
- avatar: implement avatar sizes (8deb370)
- button: change focus ring width (#1158) (b4b14cc)
- buttons: add support for width=fill prop (#1175) (a2006cd)
- button: update defaults (e213d90)
- button: update styles to match facelift designs (#1142) (836a506), closes #1143
- cssvars: replace color theming through styled-components for css vars. (#1152) (bbb78e3)
- default-theme: add support for component-level focus ring configuration (#1140) (eee10a1), closes #1141
- default-theme: update color palette (#1137) (e01d0ad)
- dialog: update styles and add corresponding stories (#1155) (5741633), closes #1156 #1161
- figma: initialize figma plugin (c82b4ca)
- force semibold on dialog headers (6303677)
- introduce
'@sanity/ui/theme'
export (b38f35a) - kbd: update primitive style, minor storybook cleanup (#1157) (b0a4082)
- menu: update menu and menu items styles (#1166) (c2e5ebc)
- reduce autocomplete radii (db3484a)
- reduce default button focus width (2ff2b63)
- release 2.0 (0ac1c8f)
- remove dialog header + footer borders (dd826ad)
- tab: update styles and add corresponding stories (#1159) (2988785)
- theme: add avatar size (9129e6f)
- theme: add label font size (abb9bb2)
- theme: parse parse compile color mix (2d049be)
- tooltip: update styles and corresponding stories (#1160) (34bf88d)
- tweak default avatar image sizes, fix avatar arrow stacking context (1c5348d)
- update avatar styles (#1183) (f7d4b94)
- update badge background colors (70b669c)
- update default avatar sizes (a288f75)
- update KBD styles and default props (7c837a0)
- update select component icon (7366ef0)
- update toast styles (0f89cc6)
- update various input styles (#1147) (fe53370), closes #1144 #1145 #1146
- add stretch fallbacks on card + selectable button styles, add mozilla fallback (981194d)
- adjust colors (0e4cabe)
- avatar: use label font (27e655d)
- badge: set color using variable (ddeb0d8)
- badge: use regular font weight (b72b338)
- build: update keywords (74cfd4d)
- build: update node version (ce69f9d)
- build: update node version (e54707c)
- button: button with right icon is pushed to the end (#1195) (ad87933)
- button: default mode (e7e3d32)
- button: render styles (35e0a91)
- button: set vertical alignment to fix unwanted margin (4d7851f)
- card: add color backdrop variable (dbcdccd)
- card: only set focus ring variable when :focus-visible (757a0d0)
- checkbox: adjust colors (7f2e7d3)
- core: add font-weight for strong font in heading (#1204) (6c430b3)
- core: improve defaults (8d4d5d9)
- correctly prefix unstable props (4e30a56)
- darken backdrop color in light mode (a12a0df)
- deps: add
react-is
peer dependency (a9549a8) - deps: update @sanity/color (a357c77)
- deps: update
@sanity/color
(2207abf) - deps: update
@sanity/color
(185d5a7) - deps: update
@sanity/color
(deeaed1) - deps: upgrade
@sanity/color
(780ee0b) - dialog: adjust padding (c4f7858)
- dialog: fix padding (5ca95c5)
- dialog: update dialog design (#1169) (477f495)
- do not scale icon strokes (0740c6b)
- ensure button primitives use the correct default mode (ccdb59e)
- facelift: add unstableDisableFocusRing prop to text inputs (#1184) (6ded803)
- figma: export muted bg (0a3a9e2)
- figma: update plugin (5229ace)
- improve scale transitions for non-retina screens (#1200) (3e52721)
- kbd: vertical alignment (cc8bc61)
- menu-button: close menus containing selected items when re-clicking the menu button (#1193) (7b60c32)
- peer-deps: remove
react-is
from peer deps (49a832c) - popover: disable
arrow
by default (9c1548e) - remove
unknown prop "animate"
console warning (aaa353c) - remove crossfade pollution on fade in transitions (#1201) (591cea3)
- remove unused
focusRing
from legacy ThemeColor interface (#1207) (2a4d9b6) - revert changes for css variables (#1172) (7cea0a3)
- revert dialog padding, include margins, add hidden close button story (d0af39d)
- revert rounded border style in tabs (a668b11)
- select: default to
radius=2
(8ac48c2) - simplify dialog header padding (2c5fee1)
- switch: adjust handle shadow (604ac42)
- switch: improve checked read-only state (6320d59)
- text-input: improve styles (eacee35)
- theme: add resolved key to v2 theme (#1203) (c81bc6d)
- theme: adjust syntax colors (a264240)
- theme: adjust vertical trimming (a00a989)
- theme: improve backwards compatibility (01da5eb)
- theme: improve backwards compatibility (54c80ba)
- theme: improve color tokens (27bea7d)
- theme: improve colors (6eed99d)
- theme: increase switch padding (e99251d)
- theme: re-introduce base focusRing value and mark as deprecated (#1162) (1fc3106)
- theme: restore selectable in v0 theme (#1206) (98447fe)
- theme: support 0 opacity (ce9929e)
- theme: tweak colors (6bbfa8a)
- theme: update avatar and badge ts descriptions, mark them as internal (ec329df)
- theme: update container width size (#1198) (9ba891e)
- tooltip: disable arrow by default (fabcbde)
- tooltips: fixes for TooltipDelayGroup, onClose and nested (#1186) (345e887)
- tooltips: update default fallback placements (#1185) (117fe85)
- tree: default font size and padding (8c279b4)
- tweak default tooltip motion values (608f66a)
- update default values for <Badge> (aaa5708)
- update default values for <MenuItem>, <TextArea> and <TextInput> (82dc8d2)
- update legacy focusRing values (cc1c7be)
- update types [skip ci] (4725af4)
- vars: minimum implementation for colors legacy support (#1167) (aca0675)
2024-03-26
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latest
This release comes with Sanity TypeGen, the new tooling in the Sanity CLI that enables extracting the schema into a static representation (
schema.json
) and to generate TypeScript type definition for it, as well as for GROQ query results.You can learn more about Sanity TypeGen:
- Blog post: Of course, you should be able to type your content quickly!
- Documentation
- New course on Sanity Learn
If you try out Sanity TypeGen, do let us know how it went in the #typescript channel in the Sanity community or to your customer success team.
This update also includes the beta of Tasks for Sanity Studio. It's a way to assign tasks related to documents, delegate them to team members, and track their status across the project.
If you wish to disable tasks, you can do so by adding the following to
sanity.config.ts
:export default defineConfig({ โฆrestOfConfig, unstable_tasks: { enabled: false, }, })
Documentation for Tasks is in the works and will be announced when ready.
- Fixes a bug where all fields got marked as non-optional when extracting schema with
--enforce-required-fields
. - Fixes a bug where Vision would insert a new line on cmd-return.
If you encounter an error such as
TypeError: Cannot read properties of undefined (reading 'div')
, please make sure your Studio doesn't depend onstyled-components@5
. Updating any such dependencies tostyled-components@6
should resolve the error:npm install styled-components@latest
2024-05-07
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
- The Portable Text Editor (PTE) now supports drag-n-dropping + pasting of images and files into
Image
andFile
blocks.
- Fixes a bug where importing a variable inside an imported file would fail in Typegen.
- Fixes issues in the PTE where tools would show as being active for a selection when only part of the selection used the tool. Now tools will show as active only when all highlighted selections use the tool.
- Fixes an
Attempted import error
related to usingswr
in embedded studios. - Fixes an issue in which listeners would sometimes not close if they were unsubscribed from shortly after opening.
- Fixes an issue in which users were incorrectly seeing the scheduled publishing upsell UI.
- When child within the PTE is created without a
_key
, we now automatically create one for it, avoiding unnecessary warning. - Fixes an issue in tasks in which the UI showed that they were created but the transaction didn't end.
- The Portable Text Editor (PTE) now supports drag-n-dropping + pasting of images and files into
2024-04-09
This release comes with version requirements for the following packages:
styled-components@6.1
(required for all Studio projects)@sanity/ui@2
(optional)
If you're maintaining a plugin for Sanity Studio, we recommend upgrading its dependencies too.
We have seen incompatibility issues when
styled-components@5
is used outside of the Vite configuration that ships withsanity
, for example, when the Studio is embedded in a Next.js or Remix project.Styled Components is a required dependency for Sanity Studio projects. By upgrading it, you can also delete the
@types/styled-components
andreact-is
dependencies that were required withstyled-components@5
:# npm npm install sanity@latest styled-components@^6.1 npm rm @types/styled-components react-is # pnpm pnpm install sanity@latest styled-components@^6.1 pnpm rm @types/styled-components react-is # yarn yarn add sanity@latest styled-components@^6.1 yarn rm @types/styled-components react-is
Note: if you have local customizations in your Sanity Studio that are using
styled-components
you may need to make some minor adjustments to the customization code. For more details, please consult the styled-components migration guide.Studio projects that use
@sanity/ui
for customizations and have it as a dependency inpackage.json
need to upgrade to@sanity/ui@2
:# npm npm install "@sanity/ui@^2" # pnpm pnpm install "@sanity/ui@^2" # yarn yarn add "@sanity/ui@^2"
Sanity Studio now ships with Tasks. You can now:
- Target tasks for specific documents
- Assigned tasks to Studio members
- Comment on tasks, and use @-mentions
- Resolve tasks
Tasks ships enabled by default. If you want to disable tasks in your Studio, you can do so with this configuration:
export default defineConfig({ // ... rest of config unstable_tasks: { enabled: false }, })
Learn more about Tasks in the documentation:
- Resolves "Masquerading as CJS and ESM" type errors
- Adds ESM with .mjs exports for full support of Node.js' native ESM mode while still offering support for
.esm.js
exports for legacy bundlers - Adds missing
sideEffects: false
conditions to package.json files, improving tree-shaking and reducing bundle sizes for embedded Sanity Studio projects - Simplifies the Shopify schema starter template
- Fixes a bug where wrongly formatted configuration would be inserted into tsconfig.json when
sanity init
was run inside of a Next.js project - Fixes an issue where importing
.scss
or.sass
files from the studio configuration or a descendant file would cause certain CLI commands to crash - Improves error message when extracted schema (from
sanity schema extract
) could not be found when runningsanity typegen generate
- Fixes an issue where the CLI might suggest deprecated Sanity v2 commands if you mistype a command name
- Makes the
current
field on slugs required when used with the--enforce-required-fields
flag insanity typegen
contexts - Fixes a bug where running
npx sanity init
in a Next.js project would break thetsconfig.json
configuration
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
We recommend that you check out the instructions for the Sanity Studio v3.37.0 release before upgrading. If you have already updated your dependencies as described in that document (I.e., you are updating from v3.37.0), you can proceed with updating your studio as normal:
npm install sanity@latest
- Fixes a regression in v3.37.0 that affected embedded studios in certain environments and test runners
- Fixes an issue where newly created studios used an outdated version of styled-components
2023-11-21
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
Sanity Studio now handles characters outside of the Latin1 range in intent or structure tool pane payloads without crashing. This fix ensures better support for multilingual content and enhances worldwide usability.
Continued improvements for the comments feature include a resolution to the layering issue that caused popovers to render behind the document pane.
The comments feature also received a quality-of-life enhancement by ensuring that the comment discard dialog appears above the document pane footer and headers, making it fully visible and accessible.
Lastly, we fixed a focus behavior where the reply comment input would unintentionally gain focus when clicking outside of it. Sanity Studio now maintains focus appropriately, only triggering when the comment input field is deliberately selected.
- Fixes the PTE toolbar menu behavior, ensuring only one menu can be open at a time.
- Resolves the odd focusing issue around comment reply inputs.
- Corrects the visual layering of the comment discard dialog to avoid it being hidden by other elements.
2021-11-09
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 configuredviews
would not appear in the fallback editor.
- Fixes an issue with GraphQL deploy causing
"Error: Cannot find module '@sanity/core/_internal'
- Support for GROQ query params in
patch
anddelete
methods in the client (#1826). Thanks, @KarlGe!
2021-03-17T11:51:00.000Z
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.
2023-05-24
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Fixes issue where image and file upload fields were not uploading data
- Fixes issue that would cause the dropdown list of autocomplete suggestions for reference fields to not overflow correctly inside the Portable Text editor
- Fixes issue where the current value of reference fields would not be displayed in the Portable Text editor
- Improves performance for arrays and portable text inputs
2022-09-27
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
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)
Search for documents containing an exact phrase by wrapping text inside double quotes.
- Upgrade
@sanity/ui
tov.0.37.22
- 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.
- Upgrade
2021-10-19
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.
2022-05-10
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
- 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
- CLI
2023-08-01
v2023-08-01 is the first update to the Sanity GraphQL API to include breaking changes, and is released as an opt-in upgrade. Your existing projects that query the previous version โ v1 โ will continue to work as before, and you donโt need to take any action until you are ready to upgrade.
To start using the newest version, please ensure that you have read the section titled Breaking Changes below. Once you are ready, change your query endpoints as follows:
// Old endpoints https://<yourProjectId>.api.sanity.io/v1/graphql/<dataset>/<tag> https://<yourProjectId>.apicdn.sanity.io/v1/graphql/<dataset>/<tag> // New endpoints https://<yourProjectId>.api.sanity.io/v2023-08-01/graphql/<dataset>/<tag> https://<yourProjectId>.apicdn.sanity.io/v2023-08-01/graphql/<dataset>/<tag>
This update adds GraphQL support for several recently added Content Lake features:
Read the updated GraphQL docs to learn how to get started with these features!
This update also introduces several adjustments to how queries are executed, which could potentially impact your query results. Before updating any of your existing v1 queries, make sure you have reviewed the following list of changes:
Previously, empty match patterns would evaluate as
true
and return all instances of the relevant type. Going forth, they will evaluate tofalse
, resulting in no output.v1 Behavior
Given the following query, v1 would return all posts:
query { allPost(where: { title: { matches: "" } }) { title } }
v2023-08-01 Behavior:
In v2023-08-01, the same query now returns no results.
Replicate v1 Behavior:
To replicate the behavior of v1, remove the empty match filter.
The method for processing match patterns has changed. Match patterns are now tokenized into terms, and all terms must be present for a match.
v1 Behavior:
In v1, this query would return posts where any of the words โquickโ, โbrownโ, or โdogโ were found in the title:
query { allPost(where: { title: { matches: "quick brown dog" } }) { title } }
v2023-08-01 Behavior:
In v2023-08-01, the same query will only return posts where the title contains all three words: โquickโ, โbrownโ, and โdogโ.
Replicate v1 Behavior:
The v1 behavior of matching individual words in a string cannot be replicated in v2023-08-01.
The handling of negative limits has been improved to better align with user expectations.
v1 Behavior:
In v1, negative values for the 'limit' parameter did not have the perhaps intuitive effect of reversing the direction of the limit. For example, one might expect that a 'limit' of -1 would exclude the last item from the result set. However, this was not the case, and the following query would return all results:
query { allPost(limit: -1, offset: 0, sort: { _createdAt: DESC }) { title } }
v2023-08-01 Behavior:
In v2023-08-01, this query now operates as one might intuitively expect: a 'limit' of -1 effectively excludes the last item from the result set.
The handling of null values when sorting has changed.
v1 Behavior:
In v1, when sorting documents by a field, if that field contained a null value, the document would not be returned in the query result. For example, consider this query sorting by
_createdAt
:query { allPost(limit: 3, sort: { _createdAt: DESC }) { title } }
If
_createdAt
is null, the document will not be returned.v2023-08-01 Behavior:
In v2023-08-01, matching documents that have
_createdAt
set to null are placed first in the returned results.Replicate v1 Behavior:
With this release we have also added a new filter called
is_defined
you can use this to remove null values from responses.query { allPost( where: { _createdAt: { is_defined: true } } limit: 3 sort: { _createdAt: DESC } ) { title } }
Custom roles that use custom content resources defined as a GROQ filter will be impacted by the move to the new GraphQL API version.
With the new GraphQL API version it now uses GROQ version
v2021-03-25
to apply the custom content resource GROQ filter as opposed tov1
. As such you must inspect the breaking changes to understand if your GROQ filter will continue to work as expected and update it if needed.For example, one example is this custom content resource GROQ filter:
foo[].bar == 'something'
In
v1
this would have returned documents where anyfoo.bar
equals โsomething"This behaves differently in
v2021-03-21
. Using an equality operator with an array traversal is not supported and will return empty results. Instead, these should be rewritten to use thein
operator:'something' in foo[].bar
A negation of an array traversal expression, e.g.,
!(foo[].bar == 'something')
, is also impacted in versionv2021-03-25
. In this version, an equality operation on an array traversal will result infalse
, so the negation will evaluate totrue
. Therefore, inv2021-03-21
, negating the original expression will return all documents.
2022-03-09
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- Temporarily bring back the internal
ConfirmDelete
component from@sanity/desk-tool
which was depended on by certain plugins
- Allow using a writable stream as the output destination in the
@sanity/export
module (thanks @tsolbjor!)
- Temporarily bring back the internal
2022-03-01
Upgrade Sanity Studio with:
sanity upgrade
- Fixes an issue where the defined `apiVersion` would not be used for document lists in the desk tool structure (thanks @barbogast!) (#3174)
- Upgrades refractor dependency to ensure a prismjs security upgrade is included (thanks @miketheman!) (#3170)
2023-04-26
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a Sanity Studio:
npm install sanity@latest
- Adds support for custom favicons - see https://www.sanity.io/docs/favicons for more information
- Improves document history performance
- Enables passing
skipVisibilityCheck
prop to preview components to avoid flickering when already in the viewport
- Fixes virtualized list (arrays) not rendering properly when inside a modal
- Fixes bug where validation messages on Portable Text annotations were shown twice
- Improves wording on message shown after successfully deleting a document
- Fixes issue where unused references are cleared on clicking outside
- Resolves issue where validation errors are not focused when clicking on an error in the panel
- Fixes issue where annotation popovers were not scrollable in the Portable Text Editor
- Fixes a bug in the Portable Text Editor, which could lead to duplicating single sentence content with mixed marks in the editor when overwritten by another text
- Fixes an issue where creating a portable text annotation and inserting a value inside it would make a listening text editor crash
- Fixes an issue where documents would sometimes automatically scroll without user actually performing a scroll
2022-12-22
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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.
- Fixed a regression with release
2022-02-01
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- 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
- 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
- Shows full name, email and login provider of the logged in user
- Link to project management interface
- 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
2024-04-30
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
Sanity Studio has always supported real-time collaboration, but you have yet to be able to see where others are working within the Portable Text Editor. By upgrading, you'll get a similar experience to Google Docs when editing block content.
This release also includes bug fixes for the Portable Text Editor:
- The Portable Text Editor will now remove the invisible Stega-encoded characters if you copy-paste from a preview using Visual Editing
- The cursor will not move out of viewpoint when deleting a character in PTE.
- Creating an annotation at the bottom of a PTE will no longer scroll you to the top.
- Fixes an issue where changing positions of items of an array within PTE would launch a cryptic error
Comments and Tasks are now officially out of beta; hence, we have updated the configuration APIs. Both comments and tasks are enabled by default and for all document types.
Configuration during beta:
// ./sanity.config.ts|js export default defineConfig({ // ... rest of config document: { unstable_comments: { enabled: false, }, }, });
New configuration (remove
unstable_
):// ./sanity.config.ts|js export default defineConfig({ // ... rest of config document: { - unstable_comments: { + comments: { enabled: false, }, }, });
Configuration during beta:
// ./sanity.config.ts|js export default defineConfig({ // ... rest of config unstable_tasks: { enabled: false }, })
New configuration (remove
unstable_
):// ./sanity.config.ts|js export default defineConfig({ // ... rest of config - unstable_tasks: { enabled: false }, + tasks: { enabled: false }, })
Thanks for all the feedback about Sanity TypeGen so far! This release ships several improvements and bug fixes:
- Sanity Typegen now supports
count
in GROQ projections - TypeGen code (
sanity.types.ts
) is now formatted when a project has a Prettier configuration - The TypeGen search path now includes
src
,app
, andsanity
folders by default - Various bug fixes for type generation
- Fixes an issue where
typegen
command would fail on relative imports - Fixes a bug where we could not extract or validate schema when the
sanity-plugin-mux-input
plugin was installed.
Do continue to give us feedback in #typescript in the community!
- Fixes ambiguous aria-labels on some Status buttons
- Fixes issue with inline text comments that would include an inline object.
- Fixes toast message for document duplicate action
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
Sanity Studio has always supported real-time collaboration, but you have yet to be able to see where others are working within the Portable Text Editor. By upgrading, you'll get a similar experience to Google Docs when editing block content.
This release also includes bug fixes for the Portable Text Editor:
- The Portable Text Editor will now remove the invisible Stega-encoded characters if you copy-paste from a preview using Visual Editing
- The cursor will not move out of viewpoint when deleting a character in PTE.
- Creating an annotation at the bottom of a PTE will no longer scroll you to the top.
- Fixes an issue where changing positions of items of an array within PTE would launch a cryptic error
Comments and Tasks are now officially out of beta; hence, we have updated the configuration APIs. Both comments and tasks are enabled by default and for all document types.
export default defineConfig({ // ... rest of config document: { unstable_comments: { enabled: false, }, }, });
New configuration (remove
unstable_
):export default defineConfig({ // ... rest of config document: { - unstable_comments: { + comments: { enabled: false, }, }, });
export default defineConfig({ // ... rest of config unstable_tasks: { enabled: false }, })
New configuration (remove
unstable_
):export default defineConfig({ // ... rest of config - unstable_tasks: { enabled: false }, + tasks: { enabled: false }, })
Thanks for all the feedback about Sanity TypeGen so far! This release ships several improvements and bug fixes:
- Sanity Typegen now supports
count
in GROQ projections - TypeGen code (
sanity.types.ts
) is now formatted when a project has a Prettier configuration - The TypeGen search path now includes
src
,app
, andsanity
folders by default - Various bug fixes for type generation
- Fixes an issue where
typegen
command would fail on relative imports - Fixes a bug where we could not extract or validate schema when the
sanity-plugin-mux-input
plugin was installed.
Do continue to give us feedback in #typescript in the community!
- Fixes ambiguous aria-labels on some Status buttons
- Fixes issue with inline text comments that would include an inline object.
- Fixes toast message for document duplicate action
2021-10-26
- 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
2023-06-29
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
Coinciding with today's studio release, we're bringing support for trying out Perspectives in the vision plugin.
With Perspectives, you can add a single parameter to fetch a either the latest draft (
previewDrafts
) or latest published (published
) version of a document.To learn more about Perspectives, read our announcement post or our documentation.
We've consolidated some helpful resources to customize the Studio experience, learn more about our latest updates, and connect with our team. You can also compare your current Studio version to the latest version available.
2023-08-08
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Adds new
token
login method for rare cases when the more secure cookie approach is not viable/wanted - Enables specifying authentication options using an object instead of
createAuthStore()
- Adds new
is_defined
filter to GraphQL APIs, mirroring thedefined()
function in GROQ. GraphQL APIs will have to be re-deployed to enable the new filter.
- Improves performance when fetching projects list as part of the
sanity init
CLI command - Fixes an issue that would give intermittent validation errors for valid string values when using a regex with global flag
- Fixes an issue where references to undeclared document types would never load
- Improves error UIs for reference values
- Improves the changes pane to show path line and change indicator correctly for the following field types:
- Array of strings (
array
of typestring
) - Array of tags (
array
of typestring
withlayout: 'tags'
) - Array of strings (
array
of typestring
withoptions.list
) - Array of emails (
array
of typeemail
)
- Array of strings (
- Adds new
2023-03-15
โ ๏ธย 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.
Upgrade the v2 version of the Command Line Interface (CLI) with:
npm install --global @sanity/cli@v2
Upgrade Sanity Studio with:
sanity upgrade
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Adds getClient() method to reference filter context
- 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
2021-08-11
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
- 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
2024-03-06
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade your Sanity Studio, run this command in its project folder:
npm install sanity@latest
Enhance editorial collaboration with the ability to attach comments directly to specific text selections. This feature includes highlight capabilities and ensures a seamless experience with updates and scrolling interactions.
Comments is available on the Growth plan (30-day free trial on new projects). You can learn more about comments in the documentation.
We've implemented a cleanup mechanism for edit state listeners to resolve issues that caused the document lists to become sluggish. Prior to this fix, open connections weren't being closed properly, leading to slow performance and potential crashes. If you've been experiencing delays or stability problems in your document lists, this update addresses those concerns.
2023-11-16
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade Sanity Studio, run this command in your project folder:
npm install sanity@latest
Separating content from presentation shouldnโt create friction. With Presentation, you can work visually โ with a clear view of structured content reuse. Presentation and visual editing is available on all plans.
Learn more about Presentation in the launch blog post
Streamline your content review process. From in-document communication to organized feedback, Comments enhances teamwork across all stages of content creation. The new Comments feature is available for projects on the new Growth plan, and up.
Learn more about the Comments beta launch
With the launch of the new Presentation tool, we have renamed the Desk tool to Structure. There are no changes in APIs at this time and no required code changes. In the near future we will rename the export and add a deprecation warning to the existing
deskTool
.For those that are depending on the old tool name
desk
in Studio customizations, this identifier changes tostructure
in this release and you should update your code accordingly.
2021-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.
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:
- Create a webhook set to trigger on create, update and delete
- Leave the Filter field empty
- 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.
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
2021-04-28
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.
- 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
2023-06-30
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes issue with small hit area for collapsible fieldsets.
- Fixes an issue where using
sanity init
on a Next.js project with embedded Studio would result in an error if an outdated version of next-sanity was being used.
2024-03-12
To initiate a new Studio without installing the CLI globally:
To upgrade a Sanity Studio, run this command in its folder:
npm create sanity@latest npm install sanity@latest
- Resolves an issue where users were not redirected to their original destination after re-authenticating, ensuring seamless access to linked content within the Studio.
_projectId
and_strengthenOnPublish
are now valid values for Initial Value Templates, allowing for Cross Dataset Reference values in templates.- Fixes a type bug where the type for
defineType
anddefineField
was not being captured correctly.
__experimental_search
is deprecated in favor of field-level search options for strings and Portable Text arrays. You should now be able to define search weights in your schema, like:
defineField({ name: 'title', type: 'string', options: { search: { weight: 10, }, }, })
- Document Actions can now specify a
group
, which will allow users to specify whether a specific document action should appear in the footer or in the document's context menu. - Adds ability to open the hotspot and crop dialog by double-clicking image preview.
2024-03-05
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Inline references and objects will now render with increased default sizes in the Portable Text Editor for easier interaction.
- Original content keys are now preserved during undo/redo operations in the Portable Text Editor. This change makes for more robust content integrity.
- Fixes an issue that allowed files to be dropped behind the open modal, leading to potentially adding files to the wrong input.
- Fixes a problem where temporary network disruptions could cause the form editor to reload and lose unsaved edits. Now, the form becomes read-only during reconnection, preserving state and changes.
- Fixes an issue where initial value templates would not accept a target dataset for cross-dataset references.
- Fixes an issue where the "disabled" state was shown indefinitely for cross-dataset references.
- Resolves a UI problem where the "cannot upload" message was incorrectly shown for extension-restricted file types during hover.
- Fixes a bug where certain selections within the Portable Text Editor were being mishandled.
- Fixes an issue where Comments would show a loading state while the form was reconnecting, preserving user comments during network issues.
2022-03-10
2022-12-21
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
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.
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.
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, }, }, })
- 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 withrenderDefault
in previous custom components. - Fixed an issue with custom sort orders
- This update fixes so that the component in the root config (ie in
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
- Fixes an issue where
2021-11-01
Fixes an issue causing GraphQL deploys to fail after installing to babel
^7.16.0
see (#2899).
2021-10-07
- 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
2023-10-18
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes a typo in a validation error message (thanks @largis21!)
- Fixes an issue where schema error messages would be shown with overlapping text on long titles/field names
- Improves typescript documentation for portable text/block content related types
- Adds some metadata to cross-dataset references when deploying GraphQL APIs in order to allow programatically resolving reference
2022-03-08
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
- Adds a check for superfluous image metadata properties being specified
- The studio now supports authentication for browsers that block third-party cookies
- 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!)
2022-09-08
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
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
- 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
2023-01-17
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
Itโs now possible to easily search for documents between two dates in the global search.
- 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
- Fixes an issue where a configured studio-wide
2021-12-06
- 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
2023-01-31
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
2023-04-18
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade an existing Studio (v3):
npm install sanity@latest
The
npm create sanity
andsanity init
CLI commands now have two new flags available:--bare
- skips the installation of a Sanity Studio. Instead, it takes you through the project and dataset creation process and prints the project ID and dataset names to the console.--env [path]
- detects the framework used in the current directory and creates a.env
file with the correct prefix for environment variables. Thepath
is optional; the default value is.env
, but you can change it to anything beginning with.env
, for example,.env.local.example
.
These flags are useful when you want to integrate an application with a new or existing project, when you have some existing Studio code you want to set up, or when you only need the Content Lake capabilities.
Lists of objects and references are now virtualized in the Sanity Studio UI. This should significantly improve performance in documents with large arrays.
Any custom Vite configuration defined in
sanity.cli.ts
will now be merged with the default configuration using Viteโs merge logic. This improvement will make it easier customize the Vite configuration without having to deeply understand the defaults. The configuration now also has improved TypeScript types.- The schema validator now checks for fields that use the
block
type outside of an array, which is not currently supported (thanks @pauloborges!)
- Resolves an error that occurred when attempting to create a document of a certain type with an empty object as the initial value, resulting in a permission error
- Addresses an issue where CSS files were not properly updated with a configured Studio base path
- Fixes a bug that caused the Studio to crash when trying to fetch user data without proper permissions
- Resolves a problem where multiple sorting options could be selected at the same time in a dropdown menu
- Addresses an issue where long filenames/MIME types were not truncated in the file picker list
- Resolves a bug that caused the Portable Text Editor to crash when encountering an invalid value.
2024-03-14
User settings (like desk list sort orders, view modes, and global search history) are now stored securely server-side by Sanity. This means that these settings do not need to be re-selected across devices or browsers, and will be persisted wherever a user logs into their Studio.
- Fixes a bug in the Portable Text Editor where merging two text blocks could result in data loss in the topmost block when several editors are inside the document.
- The schema migration CLI tooling now always places its output in the project root, and provides better messaging about this.
2024-05-08
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Fixes a regression in Presentation Tool introduced in v3.41.0 that causes it to crash in embedded studios.
2023-07-18
2023-04-04
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Improves performance when entering text in large documents
- Fixes the issue where the document pane title, as defined in the desk structure, was not being utilized properly
- Fixes a problem where intent route would not open the correct desk structure
2023-12-05
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Removes a console warning about using an experimental API version
- Adds type declarations for the
assetRequired
rule to validation for image and file schema types - Fixes an issue in the Next.js template where the
urlForImage
function would return a class instead of a url - Fixes an issue where the image crop tool would not work on touchscreen devices with connected pointer devices
- Fixes a bug in the Portable Text Editors drag-and-drop functionality that would make any block which opens in a modal, that was dragged and placed directly above an array block wrongly affect the array, leading to a โCanโt upload this file hereโ error
- Fixes an issue where the
--skip-cross-dataset-references
flag was not working withsanity dataset import
2024-02-27
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
- Added reference documentation for the
sanity/migrate
APIs.
- Adds ARIA labels to navbar icons for better accessibility.
- Fixes an issue in which the free trial popover was shown twice for new users.
- Updates placeholder color for Portable Text Editor.
- Added reference documentation for the
2022-09-21
Upgrade the Command Line Interface (CLI) with:
npm install --global @sanity/cli
Upgrade Sanity Studio with:
sanity upgrade
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
2021-08-17
- 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`
- 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`
2023-10-03
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a v3 Studio, run this command in its folder:
npm install sanity@latest
Perspectives in
listenQuery
Added support for perspectives in the
listenQuery()
method- Fixes an issue where reverting all changes to an array of primitives would not clear the list as expected
- Fixes syntax errors in schema files when initializing a blog template without Typescript in a Next.js app
- Fixes an issues with array items not showing all items inside a field group under specific conditions
- Fixes rendering issues with certain popovers being caused by wrong placement
- Improves accessibility for document lists
- Fixes an issue that could sometimes make reference validation errors disappear when switching between documents
2022-10-20
This release introduces support for shared content through cross-dataset references. Read more in the announcement: https://www.sanity.io/blog/shared-content-introduction
Order search results by relevance, created and last updated date.
- 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
2024-04-23
To initiate a new Sanity Studio project or upgrade an existing one, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.
If you are updating from a version earlier than 3.37.0, you should also check out this article to ensure your dependencies are up to date.
The Scheduled Publishing feature, which up until this release has been available as a plugin for Sanity Studio, has been moved into the core
sanity
package and enabled by default. Scheduled Publishing is available on all paid plans and trials.If you wish to opt out of Scheduled Publishing, you can do so in your Studio configuration
// sanity.config.ts export default defineConfig({ // .... scheduledPublishing: { enabled: false, } )
Go to docs and feature announcement blog post to learn more.
If you are already using Scheduled Publishing plugin, the first step is to get rid of it and update your studio to the latest release. If you already updated your studio you might have gotten an alert about this.
Run the following command in your project root to uninstall the plugin:
npm uninstall @sanity/scheduled-publishing
If you are already using Scheduled Publishing plugin, the first step is to get rid of it and update your studio to the latest release. If you already updated your studio you might have gotten an alert about this.
Run the following command in your project root to uninstall the plugin:
npm uninstall @sanity/scheduled-publishing
Next, remove the plugin from your studio configuration. Typically you'll find this in
./sanity.config.ts|js
. Find thescheduledPublishing
plugin and do the following changes in your configuration file:Before:
import {scheduledPublishing} from '@sanity/scheduled-publishing' export default defineConfig({ //.... plugins: [ scheduledPublishing({ // e.g. 12/25/2024 6:30 AM inputDateTimeFormat: 'MM/dd/yyyy h:mm a', }) ] })
After:
- import {scheduledPublishing} from '@sanity/scheduled-publishing' export default defineConfig({ // ... plugins: [ - scheduledPublishing({ - inputDateTimeFormat: 'MM/dd/yyyy h:mm a', - }) ], + scheduledPublishing: { + enabled: true, + inputDateTimeFormat: 'MM/dd/yyyy h:mm a', + } })
If you used any of the plugin's exports, you can now import them directly from the Sanity package. For example:
- import { ScheduleAction, resolveDocumentActions } from "@sanity/scheduled-publishing" + import { defineConfig, ScheduleAction, resolveDocumentActions } from "sanity"
- Fixes a bug that caused negations to be transformed to wildcard search prefixes if they appeared at the end of a search query.
- Improves error handling when attempting to run a migration against invalid project configurations.
- Fixes an issue where a document's validation panel would show a system error message when a field with a validation error was deleted.
- Fixes a bug that caused
_type
to be incorrectly parsed from statements in thefilter
parameter of document lists. - Fixes an issue that sometimes caused the Studio to load indefinitely when visited from a task notification email.
2023-01-24
2023-01-03
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
2021-03-26
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)
2021-04-26
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.
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.- The language filter can now be configured with an array of document types to control which schemas the filter will appear on (thanks @spacedawwg!).
- 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!)
2023-05-15
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
It's now possible to search within document lists. We've also improved keyboard accessibility, making it much easier to navigate between lists and the document form editor itself.
- Fixes issue where Edit intent links that opens the on-screen keyboard in iOS/android while also opening dialogs would break the layout
- Improves linking to single spans of text in the Portable Text Input
- Fixes a bug that made fields without a group appear in all groups
- Fixes a bug with the Portable Text Editor where single span texts could become out of sync with the server value
- Fixes an issue where an object fieldโs value is not unset when all object field values are empty
2023-05-31
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- Fixes an issue where change indicators were no longer showing up on boolean fields
- Adds document action custom dialog component
- Improves presence rendering performance
- Improves how focus and selection is handled and tracked in Portable Text fields
- Adds support for
<sup>
,<sub>
,<ins>
and<mark>
in @sanity/block-tools - Improves how image blocks in Portable Text fields are rendered for custom named image types
2024-04-02
To initiate a new Studio without installing the CLI globally:
npm create sanity@latest
To upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latest
- Increases the default height of the Portable Text editor
- Fixes the
--enforce-required-fields
flag for thesanity typegen generate
command not correctly respecting validation rules - Fixes a few focus issues where the Portable Text editor would sometimes jump to the start of a block or scroll to a previously opened block on focus inside of the Presentation tool
- Fixes an issue in which when the tasks panel is open, searching for content in the Cmd + K search changes target document rather than searches the studio
2022-01-17
- 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, egsanity init --coupon <code>
- 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
- Allow loading more syntaxes for the
2021-11-10
Fixes an issue causing
sanity exec
to crash
2023-02-15
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- The studio has been upgraded to use
@sanity/client
v5, which boasts full Node.js ESM runtime support, a smaller footprint and much more
- Fixed a bug that could lead to duplication of a single block in the Portable Text Editor
- The studio has been upgraded to use
2022-06-20
2023-02-01
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.
2023-03-21
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
- 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
2021-09-28
Fixes a bug when trying to filter on a
Date
type