I've noticed an issue that boolean fields created in slice machine/slice builder 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?
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?
Yes, 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 builder 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.
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?
Creating a brand new document the boolean is returning null unless I physically toggle the switch. Seems the default doesn't get passed through.
@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 primary:Object description:Array image:Object isAlignedLeft:null link:Object linkLabel:Array title:Array 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 primary:Object description:Array image:Object isAlignedLeft:false link:Object linkLabel:Array title:Array slice_label:null slice_type:"article_summary" variation:"default-slice" version:"sktwi1xtmkfgx8626"
OK, that's sounds like a bug then. I'll need to bring this up with the team.
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?