Bug with select field

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

Hello @cameron

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.

Thanks,
Priyanka

Hi @Priyanka

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?

Thanks,
Cameron

@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:
Screen Shot 2022-04-01 at 10.14.16 AM

Hello @dhayes

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.

Thanks,
Priyanka

Hello,

Any ETA on this? Is it part of https://portal.productboard.com/dy3xgwivwydsw7gltxfso9gs/c/126-bug-fix-fields-disappearing-when-a-slice-is-updated?

Thanks.

Hi David,

Sorry, we missed this one. This has been fixed:

You can send me your repo name, and I can check if this has been fixed on your repo.

Thanks.

2 posts were merged into an existing topic: Default option in select field is not working