Sanity Spaces "default" key not working to set default dataset
I can see you're working with the older __experimental_spaces feature. The good news is that this feature is now fully supported and documented as Workspaces in modern Sanity Studio (v3+). The __experimental_spaces configuration in sanity.json was the old Studio v2 approach, and it had some limitations - including the default key not always working reliably.
Here's what you need to know about migrating to the current Workspaces feature:
The Modern Approach: Workspaces
In Studio v3, workspaces are configured in your sanity.config.js (or .ts) file using the defineConfig helper. The configuration is much more robust and the default workspace behavior actually works as expected.
Here's how your configuration would look in the modern format:
import { defineConfig } from 'sanity'
import { deskTool } from 'sanity/desk'
export default defineConfig([
{
name: 'showcase-spr-2022',
title: 'Spring 2022',
projectId: 'myprojectid',
dataset: 'showcase-spr-2022',
plugins: [deskTool()],
// Add your schema and other config
},
{
name: 'showcase-win-2021',
title: 'Winter 2021',
projectId: 'myprojectid',
dataset: 'showcase-win-2021',
plugins: [deskTool()],
},
{
name: '2021-production',
title: 'Spring 2021',
projectId: 'myprojectid',
dataset: '2021-production',
plugins: [deskTool()],
},
// ... other workspaces
])The key difference: In the modern workspaces array, the first workspace in the array is automatically the default. So just put your showcase-spr-2022 workspace first, and it will be the default when users log in.
If You're Still on Studio v2
If you haven't migrated to Studio v3 yet and need to stick with __experimental_spaces, here are some workarounds:
1. Reorder your array: Move your preferred default to the first position. The Studio often falls back to using the first space when the default key doesn't work.
2. Use the query parameter: You can bookmark or share URLs with the ?space=showcase-spr-2022 parameter to force a specific space to load.
3. Consider migrating: Since the experimental spaces feature had known issues and is no longer the recommended approach, migrating to Studio v3 with proper Workspaces would give you more reliable behavior.
The default: true key in __experimental_spaces was indeed inconsistent in Studio v2, which is one reason the feature remained experimental. The modern Workspaces implementation resolves these issues with a cleaner, array-order-based approach to defaults.
Show original thread8 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.