New release: Conditional Fields
Experimental feature

Spaces

Switch between datasets in the Studio

Spaces lets you quickly switch between datasets in the studio. This may be useful when:

  • Managing multiple departments within the same organization, each with their own, separate datasets, but all sharing the same schema.
  • Modifying an existing schema type and testing how it works using a staging dataset.

A “space” is simply a mapping from a name/title to an API config. Spaces can be configured in your studio's sanity.json (under the __experimental_spaces key). Here's an example:

{
  "project": {
    "name": "Studio with spaces"
  },
"__experimental_spaces": [
{ "name": "production", "title": "Prod", "default": true, "api": { "projectId": "ppsg7ml5", "dataset": "production" } }, { "name": "staging", "title": "Staging", "api": { "projectId": "ppsg7ml5", "dataset": "staging" } } ], "//...": "..." }

This will render a dropdown to switch between spaces in the studio.

Switching to another space will connect to the dataset configured for that space.

Gotcha

Enabling spaces will add the dataset name to the Studio’s URL-scheme. This will potentially break deep links and bookmarks to the Studio.

From:

<yourname>.sanity.studio/desk/<types-and-ids>

To:

<yourname>.sanity.studio/<datasetname>/desk/<types-and-ids>

Gotcha

Administering multiple projects with __experimental_spaces does not currently work. You'll have to run separate studios to access separate projects.

Disclaimer: Experimental feature

This feature is still considered experimental, although it has been out for a while. We'll make sure to have a documented upgrade path for it that doesn't require too much work. If you need this feature, you can safely use it for the time being.

Was this article helpful?