Upgrade studio packages
From time to time, versions of packages Sanity Studio depends on needs to be upgraded. This can be done either by manually entering a new version of the dependency in your studio folder's package.json
, or by running a command from your command line.
Currently, the Studio requires the following packages and versions:
react@^18.2.x
react-dom@^18.2.x
styled-components@^6.x
Additionally, if your Studio includes customizations using @sanity/ui
, the version of @sanity/ui
required by the current version of the Sanity Studio is v2.1.0 or later. (We recommend always upgrading to the latest version.)
To upgrade from styled-components v5 to v6, you can either edit package.json directly and run npm|pnpm|yarn install
after. In addition to upgrading styled-components, you might also remove the react-is
dependency that used to be a required peer dependency of styled-components v5, unless your studio code directly depends on it.
npm install "styled-components@^6"
npm rm @types/styled-components react-is
pnpm install "styled-components@^6"
pnpm rm @types/styled-components react-is
yarn add "styled-components@^6"
yarn rm @types/styled-components react-is
Note: if you have local customizations in your Sanity Studio that's using styled-components
you may need to do some adjustments to your Studio code as well. Please consult the styled-components migration guide for more details.
npm install "react@^18.3" "react-dom@^18.3"
pnpm install "react@^18.3" "react-dom@^18.3"
yarn add "react@^18.3" "react-dom@^18.3"
Note: if you have local customizations in your Sanity Studio and are upgrading between major versions of React (e.g. going from version 17 to 18) you may need to do some adjustments to your React components as well. Please consult the React changelog for details on how to migrate to the latest version.