I have a background select field with two options - white and dark. The "white" option is the default one.
I expect that if I don't touch the field within the Prismic writing room, it would be "white" by default. However, this is not the case - instead it outputs as "undefined". Only when I go to the dashboard, open the dropdown, select "dark", then back to "white", it renders the correct value.
The "undefined" value impacts the UI of my app so it's crucial for the default value to be "white"
I believe this is because pushing Custom Type changes to your repository won't trigger an update inside the documents. If the document already existed and you add a new field, you need to perform a change inside of it to see the default field reflected.
These changes should be manual, so there are no unexpected document changes, redeploys, webhooks being fired, etc. An editor always triggers changes.
@Pau I just tested it further and it seems to be happening only if the select field is in a slice. If it's in the static zone, it's rendered correctly from the start without manually having to change the field in order for it to take effect.
@Pau I just noticed that the same thing is happening with Boolean fields.
I need to manually change the field back and forward in order for the field to be updated.
I'd consider this a critical bug as it says one thing within the Prismic writing room while the API delivers another information. Content writers can be confused by it
@Pau Are there any updates on this? I reported this bug over a month ago but unfortunately it's still a production bug that impact real websites. It showcases different values in the content room and the API. This confuses not only the content person, but also me as a developer. But it also impacts the slices themselves, as I haven't (and shouldn't since it has a default value) accounted for "undefined" value
Jumping on this thread to report the same issue for our team at Arcadia.com.
At the Prismic team's encouragement, we took a leap of faith with Slice Machine, but bugs like this make it hard to get and maintain buy-in from content teams as well as the developers who support them.
I agree the bug is crucial and needs improvement. Our team is continuously working on improving SM for a better developer and content editor experience. I'll share your feedback with them.
It’s now partially deployed on production, please contact me in private message so we can activate the fix on your repository and make sure it runs smoothly for you guys @will@jerry.nummi@dan.duett@kris