> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Studio v4 to v5

Upgrading to v5 raises the React requirement to 19.2.2 and changes the names TypeGen generates. Your schemas, plugins, and configuration are unchanged.

Sanity Studio v5 raises the minimum React version to 19.2.2 and changes how the Sanity CLI names the TypeScript types it generates. Your schemas, plugins, Studio customizations, and content APIs work exactly as before.

For most Studios this is a two-step upgrade: move to React 19.2.2, then install v5. If you use TypeGen, regenerate your types afterwards.

## Prerequisites

- A Studio running Sanity v4. If you are on v3, follow [Studio v3 to v4](https://www.sanity.io/docs/help/v3-to-v4) first, then return here.
- Node.js 20.19 or later, or 22.12 or later. v5 does not change the Node.js requirement you already meet on v4.

## Upgrade React to 19.2.2

Sanity Studio v5 requires `react` and `react-dom` at 19.2.2 or later. React 18 is no longer supported, and React 19.0 and 19.1 do not satisfy the range either.

Check the versions you have installed:

**CLI**

```sh
npm ls react react-dom
```

If you are already on 19.2.2 or later, continue to the next section.

### Move from React 18

Before you change versions, run your Studio on React 18.3 and clear any deprecation warnings it reports. Turning on React strict mode surfaces compatibility problems that only appear once you are on React 19:

**sanity.cli.ts**

```typescript
import {defineCliConfig} from 'sanity/cli'

export default defineCliConfig({
  api: {
    projectId: 'YOUR_PROJECT_ID',
    dataset: 'YOUR_DATASET',
  },
  reactStrictMode: true,
})
```

You can set the same option with an environment variable instead:

**.env.local**

```sh
SANITY_STUDIO_REACT_STRICT_MODE="true"
```

Once the warnings are resolved, upgrade React:

**NPM**

```sh
npm install react@^19.2.2 react-dom@^19.2.2
```

**PNPM**

```sh
pnpm add react@^19.2.2 react-dom@^19.2.2
```

## Install Sanity v5

Install the v5 release with your package manager of choice:

**NPM**

```sh
npm install sanity@^5
```

**PNPM**

```sh
pnpm add sanity@^5
```

Make sure your lock file is updated as well, then run your Studio to confirm it starts cleanly.

## Regenerate TypeScript types

This section applies only if you use TypeGen. Two changes in v5 affect the names in your generated types file.

- **Query name casing is preserved: **TypeGen now appends the result suffix in the casing of your query name. Queries named in `snake_case` produce differently named types than before. Names in camelCase and PascalCase are unaffected.
- **Schema types are hoisted: **Object types used more than once in your schema are now extracted and reused. This reduces duplication, and it can change both the names of hoisted types and the order they appear in.

Regenerate your types, then review the diff and update any imports that reference a renamed type:

**npm**

```shell
npx sanity typegen generate
```

**pnpm**

```shell
pnpm dlx sanity typegen generate
```

**yarn**

```shell
yarn dlx sanity typegen generate
```

**bun**

```shell
bunx sanity typegen generate
```

## Check Portable Text typography

Smart typography in the Portable Text editor is on by default in v5. Straight quotes become curly quotes and double hyphens become dashes as editors type. Sanity Studio v4.22.0 shipped this behavior turned off; v5 turns it on.

If your content pipeline depends on the literal characters editors type, you can turn smart typography off globally or per field.

## Notes for plugin authors

If your plugin supports only React 18, it will not work in a v5 Studio. Update it to support React 19.2 and publish a new version.

If your plugin already works with React 19, widen its peer dependency range to accept v5:

**package.json**

```json
{
  "peerDependencies": {
    "sanity": "^4.0.0 || ^5.0.0-0"
  }
}
```

The trailing `-0` keeps your plugin compatible with v5 prereleases while you test.

## Next steps

v5 is not the latest major version. Once your Studio runs on v5, continue with [Studio v5 to v6](https://www.sanity.io/docs/help/v5-to-v6). For everything else about keeping a Studio current, see [Upgrading Sanity Studio](https://www.sanity.io/docs/studio/upgrade).

