Installation and upgrading
To globally install/upgrade the v3 Sanity CLI:
npm install --global sanity@dev-preview
To validate you're on @3.0.0-rc.3
:
$ sanity --version
> sanity version 3.0.0-rc.3
The new CLI should work with existing v2 studios, but you won't be able to initialize new v2 studios with it.
To initiate a new Studio without installing the CLI globally:
npx create-sanity@dev-preview
To upgrade a v3 Studio:
npm install sanity@3.0.0-rc.3
Make sure your package.json
are up to date with these dependencies:
{
"dependencies": {
// if you’re depending on `@sanity/ui`
"@sanity/ui": "^1.0.0",
"sanity": "3.0.0-rc.3"
}
}
Breaking changes
Client dropped from configuration context
Removed the client
property from configuration context. Use getClient({apiVersion: '2022-06-07'})
or similar instead.
Configuration resolution order
The order in which defineConfig
resolves workspace configuration has changed.
Plugin configurations are now resolved before the configuration provided to defineConfig
is applied.
The basic principle is that the higher index a plugin has in the plugins array, the higher priority it has, because it can "overwrite" what previous plugins have configured, or choose to pass it on in the chain. Finally, the chain ends in the "root config" (i.e. in defineConfig
) which gets to determine the final output.
Before:
export default defineConfig({
// rest of config...
tools: (prev) => {
// prev = []
return [...prev, toolFromConfig]
},
plugins: [
toolPlugin1(), // prev = [toolFromConfig]
toolPlugin2(), // prev = [toolFromConfig, toolFromPlugin1]
toolPlugin3(), // prev = [toolFromConfig, toolFromPlugin1, toolFromPlugin2]
],
})
After:
export default defineConfig({
// rest of config...
tools: (prev) => {
// prev = [toolFromPlugin1, toolFromPlugin2, toolFromPlugin3]
return [...prev, toolFromConfig]
},
plugins: [
toolPlugin1(), // prev = []
toolPlugin2(), // prev = [toolFromPlugin1]
toolPlugin3(), // prev = [toolFromPlugin1, toolFromPlugin2]
],
})
Renamed modal
option in document actions
In document actions, modal
has been renamed to dialog
.
Before:
export const MyDocumentAction = () => {
// ... rest of the code
return {
// ... rest of the code
modal: ActionDialog, // <--- This is the old way of doing it
icon: RocketIcon,
label: 'My action',
}
}
After:
export const MyDocumentAction = () => {
// ... rest of the code
return {
// ... rest of the code
dialog: ActionDialog, // <--- This is the new way of doing it
icon: RocketIcon,
label: 'My action',
}
}
Notable bugfixes
- Fixes an issue causing numeric array items to disappear when clearing the input
- Fixes an issue with arrays rendering inside custom blocks
- Makes sure colors used in the review changes panel will adjust to dark mode
- Fixes an issue causing media previews to not work properly
- Fixes a edge case where a cross-dataset reference to a deleted document would prevent you changing the document with the reference
- Fixes UI issues related to adding annotations in the Portable Text Editor.
📓 Full changelog
Author | Message | Commit |
---|---|---|
Cody Olsen | chore(test-studio): bump sanity-plugin-mux-input
| 85a92a2 |
Espen Hovlandsdal | refactor: migrate from createPlugin to definePlugin
| 32c1e26 |
Fred Carlsen | fix(core): skip cross dataset validation on mutations (#3846) | 966f66a |
Herman Wikner | fix(core): hide workspace menu when there is only one workspace | de0c693 |
Bjørge Næss | feat(form): add API affordance for transforming patches | 7b4ee32 |
Bjørge Næss | chore(test-studio): add usage example for TransformPatches helper | 664f632 |
Snorre Eskeland Brekke | fix: add missing email type support to defineType et al | 699f866 |
Snorre Eskeland Brekke | fix: ObjectInputProps value now defaults to Record<string, any> to allow narrowing | 6a51f71 |
Snorre Eskeland Brekke | fix: added components with props as fallback for defineType et al | 694bcd0 |
Snorre Eskeland Brekke | fix: TypeAliasDefinition is now an interface so it can be extended | e3a1a07 |
Snorre Eskeland Brekke | fix: removed calendarTodayLabel option from date and datetime | 24879b6 |
Snorre Eskeland Brekke | fix: added min & max validation to DateRule | 585226d |
Snorre Eskeland Brekke | chore: fix test | 3bcb86b |
Snorre Eskeland Brekke | fix: removed groups from image and file definitions | c2710b5 |
Snorre Eskeland Brekke | fix: reverted decorator to use blockEditor, as that is the working property | dcf9c94 |
Espen Hovlandsdal | chore(server): add more debug logging | f505df6 |
Herman Wikner | fix(desk): font style in ConfirmDialog
| 70ec276 |
Herman Wikner | fix(form): custom preview component check in BlockObjectPreview
| 156f3a5 |
Espen Hovlandsdal | refactor(cli): always print dev vs preview warning | 227df17 |
Bjørge Næss | fix(form): don't open last item when uploading | 63eb5f7 |
Espen Hovlandsdal | refactor(core)!: rename document action modal prop to dialog
| 24fb475 |
Herman Wikner | feat(desk): scope document footer dialogs to the current pane | 303a9fa |
Espen Hovlandsdal | refactor(config)!: drop client from config context
| 569420a |
Bjørge Næss | refactor(form): reorganize member utils and create util for rendering single member | 6464c0b |
Bjørge Næss | chore(form): remove unused callback props | ce53bc6 |
Bjørge Næss | chore(types): remove debug code | 618d2dc |
Herman Wikner | fix(config): move the root config last in the chain of configs | d193a7a |
Herman Wikner | fix(config): use flattenConfig in useMiddlewareComponents to unify the order with other APIs
| 0969c0c |
Herman Wikner | fix(config): update components API tests with updated order | 209e0d3 |
Herman Wikner | test(config): update resolveConfigProperty test with the updated order
| fe7a722 |
Per-Kristian Nordnes | refactor(inputs): refactor PT-input annotation popover | 9d75577 |
Bjørge Næss | fix(form-builder): improve inputmode detection for number input and fix tests | 38df0fb |
Herman Wikner | fix(core): add missing spacing in image input | 66d1830 |
Bjørge Næss | fix(form): fallback to capitalized fieldset name if no title is given | fac025f |
Bjørge Næss | fix(form): fix collapsible fieldset state not propagated through arrays | dd61218 |
Espen Hovlandsdal | chore(test-studio): migrate some input components | 5b840e7 |
Bjørge Næss | chore(form): remove unused code | 033d6de |
RitaDias | fix: sanity dev will now react to env var (sanity staging) (#3893) | face98b |
Bjørge Næss | fix(form): fix issue with FormInput causing array items to be rendered inline | 983d11e |
Bjørge Næss | refactor(core): separate preview component props and preview callback props | f621362 |
Bjørge Næss | refactor(preview): tidy up preview APIs | e8423e9 |
Bjørge Næss | fix(core): fix crash caused by missing type name from problem group path segments | 73782f4 |
Bjørge Næss | fix(core): fix various issues with previews | 3143386 |
Bjørge Næss | fix(form): render grid previews without shadow and border | c93b168 |
Bjørge Næss | fix(core): sort out renderDefault + preview issue | b436b5f |
Bjørge Næss | fix(preview): spread prepared preview value as props | ac7dd5f |
Bjørge Næss | fix(form): make deletion of erroneus array items work again | 889c613 |
Bjørge Næss | fix(mutator): use Object.is for equality check | b83138c |
Bjørge Næss | fix(form): treat signed zeros as empty value to retain type information when clearing number input in array | 3e3239e |
Bjørge Næss | fix(form): disallow numeric values too large for JS 32 bit numbers | 320baba |
RitaDias | refactor: re-order methods in fieldpresence to reduce deadcode removal (next) (#3891) | f7595bd |
Espen Hovlandsdal | fix(errors): unify error boundaries, prevent duplicate toasts | 3897ff2 |
Marius Lundgård | chore(deps): upgrade design system packages | d7ab1b5 |
Marius Lundgård | fixup! chore(deps): upgrade design system packages | 99f82b1 |
Marius Lundgård | chore(deps): upgrade to @sanity/ui@1.0.0
| d1fb82d |
Marius Lundgård | chore(deps): upgrade @sanity/ui-workshop
| a1d53cf |
Herman Wikner | fix(core): reference preview tool tips | dfbe901 |
Bjørge Næss | chore(core): remove deprecated document action types | 975287d |
Per-Kristian Nordnes | refactor(desk): remove support for documentAction.modal (now .dialog) | 8a08db1 |
Bjørge Næss | chore(cli): replace v3 tag with version range | 9d415af |
Herman Wikner | feat(core): add scheme support in color manager | a6549b1 |
Herman Wikner | test(core): update color manager test | 693bdda |