Lets panels set their mode and requires a document type in app context
Published: November 20, 2026
A Dashboard panel can now change its own mode, and the application context now carries the open document's type. Apps that pass a document to the application context, or that render application icons, need code changes when they upgrade.
Action required
- Who's affected: apps that pass a document to
useApplicationContext, apps that calluseAgentResourceContextwithdocumentIdin a federated app, and apps that render an application'siconor passicontoupdateApplication. - What to do: pass the document's
_typeasdocument.typetouseApplicationContextand asdocumentTypetouseAgentResourceContext. Render application icons as image URLs with<img>instead of SVG markup, and stop passingicontoupdateApplication; the API sets it on deploy from app.icon. - By when: when you upgrade to 3.15.0. Without
documentType,useAgentResourceContextreports no document in a federated app, and a document withouttypeno longer type-checks.
Document types in the application context
The application context now includes the open document's _type, so a Dashboard panel can tell what kind of document your app has open, for example a sanity.asset from a sanity.asset.collection.
document.type is required. If your app passes a document to useApplicationContext, pass its _type alongside its id:
import {useApplicationContext} from '@sanity/sdk-react/dashboard'
import {useMemo} from 'react'
function DocumentView({documentId, documentType}: {documentId: string; documentType: string}) {
const context = useMemo(
() => ({
resource: {id: 'my-project.production', type: 'dataset' as const},
document: {id: documentId, type: documentType},
}),
[documentId, documentType],
)
useApplicationContext(context)
return <div>Editing {documentId}</div>
}useAgentResourceContext takes a new documentType option. In a federated app, it reports no document unless you pass documentType with documentId. Iframe apps ignore it.
Application icons are image URLs
An application's icon, and an installation's application.icon, is now the URL of an image on cdn.sanity.io, or null when the application has no icon. The API no longer returns SVG markup, so render the icon with an <img>. Studio workspace icons are still SVG markup.
The applications API is experimental, so this change ships in a minor release.
New features
Change a panel's mode from inside the panel
usePanel now returns setMode. Call it with the panel's name and 'aside' or 'full' to change how the Dashboard shows the panel.
import {usePanel} from '@sanity/sdk-react/dashboard'
function PanelHeader() {
const {view, onClose, setMode} = usePanel()
return (
<header>
<h2>{view.title}</h2>
<button onClick={() => setMode({name: view.name, mode: 'full'})}>Expand</button>
<button onClick={onClose}>Close</button>
</header>
)
}Changes
useUserPreferenceshows the key's default while the preferences API can't be reached, instead of suspending through its retries and then throwing. The failure shows onerroronce the retries run out, and the next answer from the API replaces the default. A change made with a function, or to a list, waits for the stored value instead of starting from the default.
Improvements
- Organizations from
useOrganizationanduseOrganizationsincludelogoUrl, the CDN URL of the organization's logo, ornullwhen it has none. WebWorkerPropsis exported from@sanity/sdk/dashboardand@sanity/sdk-react/dashboard, so a web worker no longer imports its props type fromsanity.
Fixes
- A read that failed with a 401 clears its error as soon as the token changes, so
AuthBoundaryrenders the retried read instead of staying on its fallback. useCurrentUserreports the new user aftersetAuthTokensets a token for a different user.