Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

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?