Boolean initialValue Not Holding State

6 replies
Last updated: Jun 17, 2021
Hi! πŸ™‚ I have a question about Boolean types.So I've created a
boolean
initialValue
to true but when I try to run locally sanity studio the toggle is in the middle πŸ€”
Am I missing something out? Sorry but I'm new to the platform
πŸ™‚
Jun 17, 2021, 4:45 PM
I've added in the
fields
array a new boolean type and run the studio
Jun 17, 2021, 4:50 PM
its for an existing one πŸ™‚
Jun 17, 2021, 4:50 PM
Initial values will only work for new documents, so anything already created would need to be set manually. However, any new documents should respect your
initialValue
setting.
Jun 17, 2021, 4:51 PM
If you have hundreds or more documents to set, you could also set them programmatically.
Jun 17, 2021, 4:52 PM
Sweet, I get it!! Thanks for the help
user A
appreciate it πŸ™‚
Jun 17, 2021, 4:53 PM
Great! πŸ™Œ
Jun 17, 2021, 4:54 PM

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?