# Removes the SDK panel and Portable Text wrapper

**Version:** v0.5.0

**Published:** November 17, 2026

Comment data and the UI are now separate: `@sanity/collaboration/sdk` exports only `SDKCommentsProvider`, and the panel and Portable Text editor come from `@sanity/collaboration/ui`. If you use the SDK panel, the SDK Portable Text wrapper, or drive `CommentsPanel` yourself, update your code when you upgrade.

## Action required

- **Who's affected: **apps that import `SDKCommentsPanel`, `SDKPortableTextComments` or `useSDKThreadCallbacks` from `@sanity/collaboration/sdk`, or that pass `threads`, `threadProps` or `onThreadCreate` to `CommentsPanel`.
- **What to do: **pass the document to `SDKCommentsProvider` and render `CommentsPanel` or `PortableTextComments` from `@sanity/collaboration/ui` inside it, then rename the props listed below.
- **By when: **when you upgrade to 0.5.0. The removed exports and props no longer exist, so code that uses them fails to build.

### Migrate the SDK panel

**Before**

```tsx
// Before
import {SDKCommentsPanel, SDKCommentsProvider} from '@sanity/collaboration/sdk'

export function Comments() {
  return (
    <SDKCommentsProvider>
      <SDKCommentsPanel
        documentId="post-1"
        documentType="post"
        compose={{fieldPath: 'title'}}
      />
    </SDKCommentsProvider>
  )
}
```

**After**

```tsx
// After
import {SDKCommentsProvider} from '@sanity/collaboration/sdk'
import {CommentsPanel} from '@sanity/collaboration/ui'

export function Comments() {
  return (
    <SDKCommentsProvider
      document={{documentId: 'post-1', documentType: 'post'}}
    >
      <CommentsPanel compose={{fieldPath: 'title'}} />
    </SDKCommentsProvider>
  )
}
```

### Migrate the SDK Portable Text wrapper

**Before**

```tsx
// Before
import {
  SDKCommentsProvider,
  SDKPortableTextComments,
} from '@sanity/collaboration/sdk'

export function Editor() {
  return (
    <SDKCommentsProvider>
      <SDKPortableTextComments
        documentId="post-1"
        documentType="post"
        path="body"
      />
    </SDKCommentsProvider>
  )
}
```

**After**

```tsx
// After
import {SDKCommentsProvider} from '@sanity/collaboration/sdk'
import {PortableTextComments} from '@sanity/collaboration/ui'

export function Editor() {
  return (
    <SDKCommentsProvider
      document={{documentId: 'post-1', documentType: 'post'}}
    >
      <PortableTextComments path="body" />
    </SDKCommentsProvider>
  )
}
```

Under a `drafts` perspective, pass the draft ID, such as `documentId: 'drafts.post-1'`, in the provider's `document`. With the published ID, the editor also moves the anchors of published comments.

### Removed and renamed props

`SDKCommentsPanel`, `SDKPortableTextComments` and `useSDKThreadCallbacks` are removed, along with `SDKCommentsPanelProps`, `SDKPortableTextCommentsProps` and the `SDKThread*` types. `context` and `onCommentCreated` move to `SDKCommentsProvider`, and its `onError` replaces `onRangeChangeError`.

If you drive `CommentsPanel` yourself, pass a flat `comments` list, on the panel or on `CommentsProvider`, instead of pre-built `threads`. Include each reply's parent: a reply whose parent isn't in the list isn't shown. Pass write overrides on `CommentsPanel` or `CommentThread` instead of `threadProps`. Rename write props wherever you pass them:

- `onThreadCreate` is `onCreate`, on the provider or the panel.
- `onEdit` is `onUpdate`, and `onDelete` is `onRemove`. `commentActions` still takes `onEdit` and `onDelete`.
- `onReactionToggle(shortName, active)` is `onReactionAdd(shortName)` and `onReactionRemove(shortName)`.
- `onRangeChange` is `onAnchorChange`.

### Error and loading behavior

With `SDKCommentsProvider`, a failed create is reported to `onError` and the composer clears. This is new for inline comments, whose composer used to keep the text. When the SDK has stored the comment, it stays on screen with `createError` and can be retried. A create that throws before anything is stored, such as when no user is logged in, saves nothing, and the text is lost. A failed reply is also reported to `onError`.

On `CommentsProvider`, a failed `onCreate` or `onReply` is reported to `onError` (default `console.error`) and then rejects, so the composer keeps the draft.

`SDKCommentsProvider` still suspends until the viewer resolves. Comments don't suspend: `loading` is `true` until they arrive.

## Improvements

- `InlineCommentInput`: Escape or Cancel closes the composer and restores the selection and the Comment button. If you've typed a draft, it asks before discarding it; pass `inputProps={{confirmDiscard: false}}` to skip the question. Custom composers can call `authoring.cancel({restoreSelection: true})` for the same behavior.

