Error When Creating a New Page Document Type

4 replies
Last updated: May 10, 2021
Hi all, new here and fairly new to Sanity so apologies if this isn't the best place to put this, but I've started getting this error when I go to create a new page. It doesn't happen for any of my other document types, only for pages. Does anyone know what might have caused this? I've tried rolling back but it didn't fix the issue.
May 10, 2021, 9:50 PM
Hi Geoff, thanks, I just removed an initial value from a string field and that seems to have fixed it. I removed the portion in bold.
name: 'template',
type: 'string',
title: 'Template',

initialValue: {
title: 'Default',
value: 'default',
}, options: {
list: [
{ title: 'Index', value: 'index'},
{ title: 'Contact', value: 'contact'},
{ title: 'Simple', value: 'simple'},
{ title: 'Default', value: 'default'}
],
},
May 10, 2021, 10:02 PM
Glad to hear it! If you want to retain the initialValue for a string list, you can add it back like this:

initialValue: 'default',
It can be a bit confusing because when setting initialValue on the document, you
do it as an object , but when setting it on the string field, it’s done as a string (or a function).
May 10, 2021, 10:09 PM
Glad to hear it! If you want to retain the initialValue for a string list, you can add it back like this:

initialValue: 'default',
It can be a bit confusing because when setting initialValue on the document, you
do it as an object , but when setting it on the string field, it’s done as a string (or a function).
May 10, 2021, 10:09 PM
Thanks!
May 10, 2021, 10:10 PM

Sanity.io – build remarkable experiences at scale

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