Non-existent slice type showing up in client.getSingle()

In my project, I have a page type called Landing with the following slices in use:

In the page builder, I have the content ordered in the document:

I am calling the information on the frontend using

export default async function Page() {
  const client = createClient();
  const page = await client.getSingle('landing');
  console.log(page.data);

  return <SliceZone slices={page.data.slices} components={components} />;
}

Upon console.log(page), the following is seen:

{
  slices: [
    {
      variation: 'default',
      version: 'initial',
      items: [Array],
      primary: {},
      id: 'featured_info$id',
      slice_type: 'featured_info',
      slice_label: null
    },
    {
      variation: 'default',
      version: 'initial',
      items: [Array],
      primary: {},
      id: 'featured_collection$id',
      slice_type: 'featured_collection',
      slice_label: null
    },
    { // Unknown article_collection object returned
      id: 'article_collection$id',
      slice_type: 'article_collection',
      slice_label: null
    }
  ],

I noticed that there is an extra slice type - article_collection being returned as part of the response. The slice type article_collection used to be part of the landing document but I have since removed it from the page. Changes have been pushed, but why is the slice type still showing up?

Wow, that sure is curious. It seems that it's possible the Landing document had an instance of the now-deleted article_collection slice when the slice was deleted from slice-machine (and the changes pushed to Prismic). That's my guess as to what happened. It seems the only way to explain how/why Prismic would return a document object with a slice that "doesn't belong."

I'd inspect the customtype > json > Main > slices > config object to ensure your phantom slice was properly removed from there. My guess is that it is gone (as you'd expect). The "ghost" that remains is probably in Prismic. So the question becomes, is it worth it to delete your document and recreate it to see if it goes away?

I hope that helps in some way. Of course, I could be totally wrong about all of this.

Thanks for the input, Neil!

I tried deleting the silce type and adding it back but the phantom slice was still there. In the end I had to delete my document and recreate it, which resolved the issue.

It was fortunate that the document was small; Had it been a larger document with lots of content, I'm not sure if deleting it would be the most optimal way..

1 Like