# Boolean Default Issue

**URL:** <https://community.prismic.io/t/boolean-default-issue/2652>\
**Category:** Developing with Prismic\
**Tags:** slice-machine\
**Created:** [November 11, 2020, 7:11pm UTC](https://community.prismic.io/t/boolean-default-issue/2652 "2020-11-11T19:11:59Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcaneshawn](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@arcaneshawn](https://community.prismic.io/u/arcaneshawn)\
**Post date:** [November 11, 2020, 7:11pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/1 "2020-11-11T19:11:59Z")

</div>

I've noticed an issue that boolean fields created in Slice Machine with a default set do not publish the default when authoring. Comes out null. In order to get a response, I have to toggle the switch at least once when authoring the content. Anyone else experience this?

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 12, 2020, 12:44pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/3 "2020-11-12T12:44:28Z")

</div>

Hi Shawn,

Thanks for pointing this out, I'm going to bring it up with the team. To help me reproduce this error, can you give me your repo URL?

Thanks.

---

<div class="post-metadata">

**Author:** ![arcaneshawn](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@arcaneshawn](https://community.prismic.io/u/arcaneshawn)\
**Post date:** [November 12, 2020, 2:30pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/4 "2020-11-12T14:30:03Z")

</div>

Yes, [slicemachinetest.prismic.io](http://slicemachinetest.prismic.io) and is happening in my ArticleSummary shared slice. I have a boolean control that is set to true by default (using the checkbox in Slice Machine that says "defualt to true") that sets the image on the left or the right. It was returning null for the ones I didn't modify instead of returning the default of true. I had to physically go into the editor and toggle the switch at least once to get a response that wasn't null. Seems like it might be a bug. Please let me know if you find anything on my end that would cause that. Thanks.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 12, 2020, 4:31pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/5 "2020-11-12T16:31:47Z")

</div>

Hey again Shawn,

For this one are you saying that you added the boolean and then needed to go to old documents and republish them so that the boolean isn't null?

Or that even if you create a new document you need to toggle the boolean field to not have a null response?

---

<div class="post-metadata">

**Author:** ![arcaneshawn](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@arcaneshawn](https://community.prismic.io/u/arcaneshawn)\
**Post date:** [November 12, 2020, 5:52pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/6 "2020-11-12T17:52:31Z")

</div>

> [@Phil](#):
>
> For this one are you saying that you added the boolean and then needed to go to old documents and republish them so that the boolean isn't null?
> 
> Or that even if you create a new document you need to toggle the boolean field to not have a null response?

Creating a brand new document the boolean is returning null unless I physically toggle the switch. Seems the default doesn't get passed through.

---

<div class="post-metadata">

**Author:** ![arcaneshawn](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@arcaneshawn](https://community.prismic.io/u/arcaneshawn)\
**Post date:** [November 12, 2020, 6:08pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/7 "2020-11-12T18:08:59Z")

</div>

@Phil @alws Just created another document with two instances of this slice. On the first one, I left the default with was true and on the other I toggled it to false. In my vue dev tools I see the this for the first response:

```
slice:Object
items:Array[1]
primary:Object
description:Array[1]
image:Object
isAlignedLeft:null
link:Object
linkLabel:Array[1]
title:Array[1]
slice_label:null
slice_type:"article_summary"
variation:"default-slice"
version:"sktwi1xtmkfgx8626"

```

As you can see "isAlignedLeft" is null. But on the second instance, that I physically toggled to false:

```
slice:Object
items:Array[1]
primary:Object
description:Array[1]
image:Object
isAlignedLeft:false
link:Object
linkLabel:Array[1]
title:Array[1]
slice_label:null
slice_type:"article_summary"
variation:"default-slice"
version:"sktwi1xtmkfgx8626"
```

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 13, 2020, 5:02pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/8 "2020-11-13T17:02:16Z")

</div>

OK, that's sounds like a bug then. I'll need to bring this up with the team.

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [November 20, 2020, 2:53pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/10 "2020-11-20T14:53:16Z")

</div>

I've passed this on to the team they'll update you here if we have anymore info. Though I think this might be related to state not being set in Slices automatically in general, like this date field issue [Timestamp inside slice - possible to use default: now?](https://community.prismic.io/t/timestamp-inside-slice-possible-to-use-default-now/298)

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [December 9, 2020, 4:11pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/11 "2020-12-09T16:11:11Z")

</div>

This is being tracked as an open feature request.

If you have another use-case for this feature, you can ['Flag' this topic to reopen](https://community.prismic.io/t/re-open-a-thread/2175). Please use the ❤ button to show your support for the feature and check out our [Feature Request Guidelines](https://community.prismic.io/t/feature-requests-what-do-you-already-love-what-could-be-better/844).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [May 5, 2021, 8:22pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/12 "2021-05-05T20:22:13Z")

</div>



---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [May 12, 2021, 2:24pm UTC](https://community.prismic.io/t/boolean-default-issue/2652/13 "2021-05-12T14:24:45Z")

</div>

A post was merged into an existing topic: [Add ability to include a Default Value to fields in the content builder](https://community.prismic.io/t/add-ability-to-include-a-default-value-to-fields-in-the-content-builder/2601/5)

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 19, 2021, 10:20am UTC](https://community.prismic.io/t/boolean-default-issue/2652/19 "2021-07-19T10:20:02Z")

</div>



---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 19, 2021, 10:20am UTC](https://community.prismic.io/t/boolean-default-issue/2652/20 "2021-07-19T10:20:47Z")

</div>

@skedify This should be fixed now. Please update to the latest: `npm install slice-machine-ui@latest`

It seems it was actually an issue with the custom types. Saving boolean fields again should fix it:

1. Go to your Custom type
2. Edit the boolean field and toggle "default to true" and save
3. Reload the custom type: the default value should still be set to true
4. Create a new document and save it
5. Check the value of the field: it should be set to true by default

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [December 13, 2021, 10:54am UTC](https://community.prismic.io/t/boolean-default-issue/2652/25 "2021-12-13T10:54:11Z")

</div>


