Newly added field to custom type not reflected on API

rediane.zemmouri
Wed, 16 Oct 2024 11:20:40 +0000
Developing with Prismic

Describe your question/issue in detail

I am using the prismicio/client javascript library to use the documents API. We decided to add a new field "parent" to a custom type. it's a "Selectbox" field and I picked the first option as the default value.
In Prismic's side, all works accordingly, however, on the API side, all the documents returned have a "null" parent. After some research, I found that I need to publish the document for the update to be shown on the API's side.
But most of the documents need to have the first option which I put as the default one for a "parent" value. As a matter of fact, only 2 documents need to have a different value.
In practice, it means i have to follow these steps for each document (!) if i want the API to return the new field:
1- Open the document in prismic
2- add a space on the title (or any other) field to enable the save button
3- click on save, then click on publish

This is overkill if i have a considerable amount of documents for that custom type... Is there any way to just publish all the documents without having to open them and edit them one by one for no reason ?

What steps have you taken to resolve this issue already?

I have googled, looked in the forum, asked chatGPT

3 posts - 2 participants

Read full topic