Sanity Studio v5.2.0: TypeGen improvements for Svelte, enhanced object dialog (beta) improvements, and various bug fixes

TypeGen improvements for Svelte

TypeGen will now find queries declared in .svelte files. It also automatically looks for .svelte and .vue files in your ./src or ./app folders. If you've already set up typegen in your Svelte app and configured path, you may need to add svelte to your file endings in order to find the queries. This is typically located in sanity.cli.ts under the typegen configuration property.

TypeGen query detection now supports defineQuery imports from @sanity/sveltekit in addition to groq and next-sanity.

Enhanced object dialog (beta) improvements

Enhanced object dialog was originally introduced in Studio version 4.12.0.

Improves keyboard accessibility for navigation breadcrumbs.

Adds array titles to the breadcrumbs in the enhanced object dialog. An example: previously, the breadcrumbs would render as (Field title / #4 Item 4 / #3 Item 3) but with this update, they will instead display information of the field from which the items come (Field Title / #4 Item 4 / Parent field of the next item / #3 Item 3).

Overall accessibility label improvements for breadcrumbs.

Fixes issue where navigating across items would not reset scroll top of the dialog.

Fixes issue where clicking escape in a full-screen pte while editing an image would not fall back to the full screen and would instead close the whole modal.

Other features

New quick links to navigate to lists of all scheduled drafts and content releases from the releases dropdown list.

Visual refinements to the document header versions list.

All content releases may now be duplicated.

All content releases may now be reverted.

TypeGen now performs narrowing in more scenarios based on filter predicates. Simple predicates like defined(field) and foo == "bar" now narrow their subject. In this example, foo will be typed as a string literal with the value "bar". ORs, and more complex assertions, are not yet narrowed.

🐛 Notable bugfixes

Fixes issue causing custom reference filters to receive a stale document value.

Fixes issue causing reference search to keep showing a spinner when there are no hits.

Fixes an issue causing custom access roles with _type-based resource filters to disallow creating new documents where this should be allowed.

Fixes a regression where ServerStyleSheet from styled-components was reintroduced, breaking compatibility with @sanity/css-in-js. Users who override styled-components with @sanity/css-in-js will no longer encounter build errors about missing ServerStyleSheet export.

Fixes an issue where newer plugins that no longer ship CJS formats and contain CSS imports would cause an ERR_UNKNOWN_FILE_EXTENSION error when running commands like sanity schema extract.
sanity-plugin-markdown stopped shipping CJS and has been ESM only since v7 and was impacted by this.

Fixed Rule.fields() validation when used inside Rule.all() or Rule.either() combinators.