Documents need to be artificially republished to register content type changes

When adding slices to a custom type, we've found that it's necessary to unpublish and republish any one document from that type before the Prismic API will recognize that the slices have been added. Not performing that extra step has resulted in a production bug where the graphQuery for those pages is considered inaccurate and thus none of the pages from that custom type have any of their associated data; the api response is an empty object. This seems to be a bug with Prismic, and it's a very easy trap to fall into since there's no prima facie reason you should have to artificially republish a document before deploying.

Thank you for sharing your use case @connor.mooneyhan,

To clarify, Slices are not meant to show up automatically in documents when you add them to a Custom Type. Content editors add the Slice with content to the document. Additionally, unpublishing and republishing a document isn't necessary in order for the Prismic API to recognize that Slices have been added. Since it's a separate process.

Please let us know if you have any further questions or concerns.

@Pau Ah, I think I miscommunicated. We're not adding the slices to any specific document, we're adding the slice to the content type model and then deploying before we've used the slices in a document. Then, when we fetch the page with graphQuery and try to account for the fields in those new slices (i.e. adding the new slice and its fields to the graphQuery), the API reads the query as invalid and returns an empty object.

I understand maybe the documents require a small change to detect the new structure of the API. I'll share your use case with the team.

1 Like