v3.0.0-rc.0 #3830
Replies: 4 comments 1 reply
-
Amazing work y'all 🎉 |
Beta Was this translation helpful? Give feedback.
-
I discovered a strange bug with Template: {
id: 'prefilledEvent',
schemaType: 'event',
title: 'Prefilled Event',
parameters: [
{ name: 'name', type: 'string' },
{ name: 'location', type: 'address' },
],
value: (props: any) => props,
} newDocumentOption {
id: 'prefilledEvent',
templateId: 'prefilledEvent',
type: 'initialValueTemplateItem',
title: 'Prefilled Event',
parameters: {
name: 'Example Event',
speakers: [{ _ref: '417bf944-ecc7-4d22-be1d-de90fdf878d1' }],
location: JSON.stringify({
name: 'Test Name',
street: 'Teststreet 12',
city: 'Ascona',
zipCode: '1234',
}),
},
} everything works as expected. As soon as "Prefilled Event" is selected from the document list action, the values are nicely prefilled. Side note: the filling of values does not work over the "new document" pane - even tough the template id is in the URL, the values are never filled in the new document). But now if there is a special char in the document data, the whole step "crashes" printing "Failed to parse JSON parameters" in the console. Here is an example payload for the above defined template: {
id: 'prefilledEvent',
templateId: 'prefilledEvent',
type: 'initialValueTemplateItem',
title: 'Prefilled Event',
parameters: {
name: 'Example Event',
speakers: [{ _ref: '417bf944-ecc7-4d22-be1d-de90fdf878d1' }],
location: JSON.stringify({
name: 'Test Name',
street: 'Test-Muster Strasse 12',
city: 'Ascona',
zipCode: '1234',
}),
},
} |
Beta Was this translation helpful? Give feedback.
-
Seeing unexpected cli version after updating:
Above all looks good, but then using sanity binary exposed via npm script:
I don't think I actually have a problem, just strange. |
Beta Was this translation helpful? Give feedback.
-
I'm now seeing TS errors on any field that defines custom components.
It seems Following this pattern:
NOTE: Everything is still working at runtime. |
Beta Was this translation helpful? Give feedback.
-
Sanity Studio v3: Release Candidate
This is the first Release Candidate of Sanity Studio v3. That means that you can expect APIs marked
@public
to be stable going forward. We are still ironing out bugs and making improvements, and appreciate any input or questions you might have.We also want to invite you to a Sanity virtual event on December 8th, where we will dive into customer stories, demos, and talk about where the Sanity platform is headed.
You might also want to check out the notes for recent releases.
Installation and upgrading
To globally install/upgrade the v3 Sanity CLI:
To validate you're on
@3.0.0-rc.0
: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:
To upgrade a v3 Studio:
Make sure your
package.json
are up to date with these dependencies:You might also have to upgrade your Sanity v3 plugins to their latest versions. The following command might be useful for checking for plugin updates:
Breaking change:
sanity start
is nowsanity dev
In Studio v2 and earlier developer preview releases, the command
sanity start
was used to start the development server. To better align with other frameworks such as Next.js, Remix, and Gatsby, we have renamed the command tosanity dev
. Thesanity start
command is now used to start a static server that can be used to preview a production build (it is also available assanity preview
).For existing studios, you might want to add a new
dev
npm script to yourpackage.json
file to make sure your team knows about the change:Breaking change:
createConfig
is nowdefineConfig
To better align with other frameworks, we have renamed the following
create
-methods:createConfig
->defineConfig
createCliConfig
->defineCliConfig
createPlugin
->definePlugin
The old
create
-methods will still work for the time being, but are deprecated and will be removed prior to the final release of v3.Beta: Add custom functionality to array inputs
It is now possible to customize the array input with custom functions. The API allows you to replace the Add button and exposes different methods through its properties for interacting with array content.
This feature also introduces breaking changes for callback namings and typings (see below).
Example of custom array functionality in
defineConfig
:For feedback and questions on this API, go to GitHub Discussions.
Breaking change: Advanced input component callbacks
We've aligned our API naming policy for callbacks to be
on<Subject><Verb>
. For improved consistency, we have renamed the following callbacks:onFocusPath
->onPathFocus
onCollapseFieldSet
->onFieldSetCollapse
onExpandFieldSet
->onFieldSetExpand
onCollapseField
->onFieldCollapse
onExpandField
->onFieldExpand
onOpenField
->onFieldOpen
onOpenItem
->onItemOpen
onCloseItem
->onItemClose
onRemoveItem
->onItemRemove
onPrependItem
->onItemPrepend
onAppendItem
->onItemAppend
onCollapseItem
->onItemCollapse
onExpandItem
->onItemExpand
onCreateValue
->onValueCreate
These callbacks are mostly used for complex custom object/array inputs.
Breaking change: Array functions components/types
We've improved "array functions" - see above. With this change comes a few naming changes:
DefaultArrayOfPrimitivesFunctions
->ArrayOfPrimitivesFunctions
DefaultArrayFunctions
->ArrayOfObjectsFunctions
FormArrayInputFunctionsProps
->ArrayInputFunctionsProps
The default array functions components (
ArrayOfPrimitivesFunctions
andArrayOfObjectsFunctions
) are now exported from thesanity
package.All default input components are now exported
All the standard inputs are now exported and available in the sanity package for use when building custom input components.
Notable bugfixes
📓 Full changelog
sanity preview
commandstart
command todev
sanity start
alias forsanity preview
dev
npm script to package.jsonhttp-server
dependency, usesanity start
commandpreview
to list of known core commands@sanity/ui
updateArrayFunctions
from configTagsArrayInput
GridArrayInput
ListArrayInput
ArrayOfPrimitivesInput
ArrayOfObjectsFunctions
andArrayOfPrimitivesFunctions
ReturnType
onsetTimeout
instead ofNodeJS.Timeout
cacheDir
to avoid cache conflictsrequire
pathdetail
layout on demossanity.config
createConfig
todefineConfig
@sanity/ui
,@sanity/colors
,@sanity/icons
This discussion was created from the release v3.0.0-rc.0.
Beta Was this translation helpful? Give feedback.
All reactions