When using a select field and checking the 'Define first value as default' option this returns null if not changed when creating the custom type. I was getting null for all types using the default value until I went into it, selected the second option, re-selected the first option and re-published.
I can't imagine this is the expected behaviour!
Let me know if i'm doing something wrong or if this is an issue
Welcome to the Prismic community, and thanks for reaching out to us.
This is the expected behavior. When you add or update any field in the Custom Type, you must always edit documents related to it. It's true that you always need to select the second option, re-select the first option, and re-published the documents.
Let me know if you have any other questions.
Does this not make the default value essentially useless? The default value is always
null then, which doesn't reflect the
Define first value as default?
@cameron True. I will report this to our product team so they can work on it. Thanks.
I have a new slice that was made with SliceMachine and it has two fields with a default value (one is a select field and the other a boolean). However, they aren't actually being set by Prismic when a record is created/published as they return "null".
This is the setup in model.json:
This is what gets returned:
This is a known bug and has already submitted an issue in the issue tracker.
Meanwhile, go to your documents, select the second option for the field and re-select the default value and re-published the documents. That's how you can get the default value in the API.