🎤 Builder Talk: The Story Behind Lady Gaga’s Digital Experience – Register now

Discussion about upgrading Sanity version and resolving a bug with hidden fields in schema type definition.

24 replies
Last updated: Jun 30, 2021
text: {
    type: 'string',
    name: 'type',
    initialValue: 'text',
    readOnly: true,
    hidden: true,
  },
Jun 30, 2021, 9:19 AM
Which version of the studio are you running? Version
v2.12.0
and
v2.12.1
had a bug where this would happen, but it was fixed in
v2.12.2

(Appreciate if you use a single message to ask questions by the way, so it's a little easier to reply in a thread
🙂)
Jun 30, 2021, 11:04 AM
let me check
Jun 30, 2021, 11:05 AM
➜  cms git:(feature/form-builder-cms) ✗ sanity upgrade

✔ Saved lockfile

✔ Modules upgraded:
@sanity/cli        2.12.0 → 2.12.2
@sanity/core       2.12.0 → 2.12.2
@sanity/desk-tool  2.12.0 → 2.12.2
Jun 30, 2021, 11:07 AM
Let me know if that solved the issue 🙂
Jun 30, 2021, 11:07 AM
testin right now
Jun 30, 2021, 11:07 AM
nope
Jun 30, 2021, 11:07 AM
the fields is still there
Jun 30, 2021, 11:08 AM
how can I get the version of the studio?
Jun 30, 2021, 11:11 AM
sanity versions
in the studio root
Jun 30, 2021, 11:11 AM
I did it
Jun 30, 2021, 11:12 AM
but there’s any studio
Jun 30, 2021, 11:12 AM
Did you restart the sanity development server after upgrading? Also, could you paste the entire schema type definition? Fields should be declared in an array, but the example you showed is an object, so I'm a bit confused
Jun 30, 2021, 11:12 AM
yep
Jun 30, 2021, 11:12 AM
yeah cause I spread that fields
Jun 30, 2021, 11:12 AM
I have this
Jun 30, 2021, 11:13 AM
export default [
  {
    title: 'Layout',
    name: 'layout',
    type: 'string',
    fieldset: 'layout',
    initialValue: 'wide',
    required: true,
    options: {
      list: [
        { title: 'Largo', value: 'wide' },
        { title: 'Stretto', value: 'narrow' },
      ],
    },
  },
  {
    type: 'boolean',
    name: 'required',
    title: 'Richiesto',
    initialValue: false,
  },
];
Jun 30, 2021, 11:13 AM
export default [
  {
    title: 'Layout',
    name: 'layout',
    type: 'string',
    fieldset: 'layout',
    initialValue: 'wide',
    required: true,
    options: {
      list: [
        { title: 'Largo', value: 'wide' },
        { title: 'Stretto', value: 'narrow' },
      ],
    },
  },
  {
    type: 'boolean',
    name: 'required',
    title: 'Richiesto',
    initialValue: false,
  },
];
Jun 30, 2021, 11:13 AM
and I’m using it in this way
Jun 30, 2021, 11:13 AM
fields: [

...defaultForm.fields,

typeOfFields.text,

{

type: 'string',

name: 'label',

title: 'Label del campo',

initialValue: 'Cognome',

},

],
Jun 30, 2021, 11:13 AM
where the code above is spread by
...defaultForm.fields
Jun 30, 2021, 11:14 AM
But I’ve tried to put them without spread and the result is the same
Jun 30, 2021, 11:16 AM
But I’ve tried to put them without spread and the result is the same
Jun 30, 2021, 11:16 AM
fixed after a couple restart 🙂
Jun 30, 2021, 11:18 AM
thank for your time
Jun 30, 2021, 11:18 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
Hey all - what’s the quickest way to batch delete all documents of a certain type? It looks like the `sanity` cli tool allows...Jan 29, 2021
Best way to convert HTML to a PortableText object?Dec 3, 2020
Rendering nested block contentJan 18, 2021
CLI Error - zsh: command not foundJan 29, 2022
DOMParser is not defined at defaultParseHtmlDec 3, 2020
Next.js and Vercel - Error! No Output Directory named "dist" foundAug 8, 2022
List Arrays - Is it Possible to Fill a List Array Within a Schema Asynchronously?Mar 16, 2021
Custom Document Views - Is it Even Possible to Use the Structure Builder?Apr 21, 2022
TypeError: Cannot Read Properties of Null (Reading 'jsonType')Sep 28, 2022
Error in custom validation rule for schema in Slack threadAug 18, 2023

Related contributions

Turbo Start Sanity
- Template

The battle-tested Sanity template that powers Roboto Studio's websites

Go to Turbo Start Sanity

Schema UI - Next.js Sanity Starter
- Template

A Next.js starter template with Next.js 15, Tailwind CSS, shadcn/ui, and Sanity CMS with Live Editing. Get production-ready React components with matching Sanity schemas and queries. Build dynamic pages faster while keeping full control over customization.

Serge Ovcharenko
Go to Schema UI - Next.js Sanity Starter

The Swaddle
- Made with Sanity

A new brand identity to represent a more mature company, to signify The Swaddle’s evolution from publisher to production house, combined with an easier to navigate platform that can surface multiple content types - drawing readers through The Swaddle’s content offering.

Nightjar
Go to The Swaddle