Add conditional workspace visibility and general bug fixing

Published: April 22, 2026

v5.22.0

New hidden property in workspace configuration

New hidden property on workspace configuration. Accepts a boolean or a callback that receives {currentUser} and returns true to hide the workspace.

hidden: ({currentUser}) => {
  if (currentUser === null) return false
  return !currentUser.roles.some((role) => role.name === 'administrator')
}
  • hidden: true hides the workspace unconditionally.
  • hidden: (context) => boolean evaluates after authentication resolves.
  • Before auth completes, currentUser is null. Handle this in callbacks.
  • Client-side UI visibility only. Enforce access control server-side via Sanity role-based access controls (RBAC)

🐛 Notable bugfixes and improvements

  • References in dialogs and popovers will be visible with the available space and not hide under different sections of the UI
  • Fixes a bug breaking document lists sorting on a sub path (e.g. slug.current) when using the groq2024 search strategy.
  • Fixed programmatic focus (e.g. jumping to a divergence from the overview) when inline changes mode is on. Previously the focus was silently dropped for string fields in this mode.
  • BlockRule now uses PortableTextBlock instead of any[], matching the actual runtime value passed to custom validators.
  • Fixes an issue where document list previews could fail to load on slower connections due to redundant network requests triggered by unrelated document mutations.
  • CLI: Adds --skip-content-releases flag to sanity datasets copy for excluding content release documents from the target dataset.
  • CLI: MCP auto-configuration now supports Antigravity, Cline CLI, Codex CLI, GitHub Copilot CLI, and MCPorter.
  • CLI: Fixed environment variable loading to include all variables from .env files, not just SANITY_STUDIO_/SANITY_APP_ prefixed ones. Client bundle exposure remains restricted to prefixed variables only.

Related documentation

Loading...