# Lets panels set their mode and requires a document type in app context

**Version:** v3.15.0

**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 call `useAgentResourceContext` with `documentId` in a federated app, and apps that render an application's `icon` or pass `icon` to `updateApplication`.
- **What to do:** pass the document's `_type` as `document.type` to `useApplicationContext` and as `documentType` to `useAgentResourceContext`. Render application icons as image URLs with `<img>` instead of SVG markup, and stop passing `icon` to `updateApplication`; the API [sets it on deploy from app.icon](https://www.sanity.io/docs/app-sdk/sdk-configuration).
- **By when:** when you upgrade to 3.15.0. Without `documentType`, `useAgentResourceContext` reports no document in a federated app, and a document without `type` no 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](https://reference.sanity.io/_sanity/sdk-react/dashboard/useApplicationContext/), pass its `_type` alongside its `id`:

**DocumentView.tsx**

```tsx
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](https://reference.sanity.io/_sanity/sdk-react/dashboard/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](https://reference.sanity.io/_sanity/sdk-react/dashboard/usePanel/) now returns `setMode`. Call it with the panel's name and `'aside'` or `'full'` to change how the Dashboard shows the panel.

**PanelHeader.tsx**

```tsx
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

- [useUserPreference](https://reference.sanity.io/_sanity/sdk-react/exports/useUserPreference/) shows the key's default while the preferences API can't be reached, instead of suspending through its retries and then throwing. The failure shows on `error` once 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 [useOrganization](https://reference.sanity.io/_sanity/sdk-react/exports/useOrganization/) and [useOrganizations](https://reference.sanity.io/_sanity/sdk-react/exports/useOrganizations/) include `logoUrl`, the CDN URL of the organization's logo, or `null` when it has none.
- [WebWorkerProps](https://reference.sanity.io/_sanity/sdk/dashboard/WebWorkerProps/) is exported from `@sanity/sdk/dashboard` and `@sanity/sdk-react/dashboard`, so a web worker no longer imports its props type from `sanity`.

## Fixes

- A read that failed with a 401 clears its error as soon as the token changes, so `AuthBoundary` renders the retried read instead of staying on its fallback.
- `useCurrentUser` reports the new user after `setAuthToken` sets a token for a different user.

