Changing field type - unexpected behaviour

There is a glitch in the system that requires manual intervention similar to the not applied default values.

When you change a field type - ie from RichText to Text by either deleting or modifying the json model - and you keep the Api ID, the original values of those fields will still be shown in the Prismic UI in each document, but the API will return null. Once you make a slight change on any field and republish the doc, the api fields are populated with the original value.

Hi @peter2,

Thanks for reaching out.

This is not an issue but is meant to be by design to avoid breaking the production website when somebody changes a custom type. When you change a custom type, you need to minor modifications, save, and publish as explained in this article.

Please let us know if you need any further assistance,
Fares

Hi Faes,

I'm not talking about changing the custom type, but changing a field type from Rich Text to Text. The article only refers to Custom Types and I have not seen any other article that talks about changing field types.

Tthe way it's currently handled is at least misleading and broke my production website because as soon as I changed the field type and deployed the code, Prismic incorrectly showed values, but the API field was empty and thus the production website content was missing/broken.

The additional issue which I forgot to mention was that I had to rewrite the text as the converted RichtText to Text value had non-beaking spaces   instead of normal spaces. So, in those cases it broke the website twice.

Peter

@peter2, we've mentioned this in different threads in the past. Prismic can't know that a field has been changed to another type. So you need to be careful when moving from field types. See Phil's related response about this topic: