Persistent UID in page data even after removing the UID field from Page type

Describe your question/issue in detail

When I was starting out my project I used UID field to play around and later, I removed it.
Unfortunately it stays in the fetched page data for some reason. I need to get rid of it from single page types as it interferes with my dynamic sitemap generation.

How can I make sure that UID is gone from the page data? For master locale AND for alternate languages? I have no use for it but it stops me from doing certain things with my code.

Example on 'home_page', the UID field does not exist on this type in my model as I'm not using it for anything.

{
  id: 'ZYGaGBEAAAIh5ecg',
  uid: 'home',
  url: '/',
  type: 'home_page',
  href: 'https://sia-next.cdn.prismic.io/api/v2/documents/search?ref=ZjTaeRIAACQAzI8D&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22ZYGaGBEAAAIh5ecg%22%29+%5D%5D',
  tags: [],
  first_publication_date: '2023-12-19T13:26:55+0000',
  last_publication_date: '2024-05-03T12:35:53+0000',
  slugs: [],
  linked_documents: [],
  lang: 'en-gb',
  alternate_languages: [
    {
      id: 'ZZaWCREAAG8AnbjM',
      type: 'home_page',
      lang: 'de-de',
      uid: 'home-de'
    },
    {
      id: 'ZZaV9hEAAFMAnbip',
      type: 'home_page',
      lang: 'fr-fr',
      uid: 'home-fr'
    },
    {
      id: 'ZZaVzBEAAFMAnbg3',
      type: 'home_page',
      lang: 'es-es',
      uid: 'home-es'
    },
    {
      id: 'ZZ6xBBEAADoiT_TN',
      type: 'home_page',
      lang: 'en-us',
      uid: 'home-us'
    }
  ],

What steps have you taken to resolve this issue already?

Republishing the pages, making sure it doesn't exist in the models etc.

Your Role

Developer

Steps to reproduce

  1. Create Single page type.
  2. Add UID field in slice machine to that page type.
  3. Put something in that field via Page Builder. For example 'home-alternate' and publish the page.
  4. Remove the field in Slice Machine.
  5. The field is gone in page builder, republish the page.
  6. Try to fetch the page and see it's properties for example via console.log
  7. UID will still be there while it should not.

Hi @dmakos , thanks for reporting the issue. I'm following up with the team and will let you know when we have a fix for this.

Best,
Guy

1 Like

Hi, any update on this one please? Thanks

Hi @dmakos , not at this stage. We had some other tasks that were a higher priority. I should have an update for you in the next couple of days.

Best,
Guy

1 Like

@dmakos I just wanted to send a quick update. We are hoping to push a fix for this today. I'll let you know once it is done.

Best,
Guy

1 Like

@guy.proops thanks for the update. :slight_smile:

@dmakos the issue has now been resolved. However, to ensure it is working correctly, the user must update and save the page to ensure the UID is removed from the API.

@guy.proops
Hey, I had some time today to look at this - I saved the pages and republished them but I still get non-existing UIDs in 'alternate_languages' from the API:

[
  {
    id: 'ZZaV9hEAAFMAnbip',
    type: 'home_page',
    lang: 'fr-fr',
    uid: 'home-fr'
  },
  {
    id: 'ZZaVzBEAAFMAnbg3',
    type: 'home_page',
    lang: 'es-es',
    uid: 'home-es'
  },
  {
    id: 'ZZaWCREAAG8AnbjM',
    type: 'home_page',
    lang: 'de-de',
    uid: 'home-de'
  },
  {
    id: 'ZZ6xBBEAADoiT_TN',
    type: 'home_page',
    lang: 'en-us',
    uid: 'home-us'
  }
]

What am I missing? :frowning_face:

The uid on the page document is showing as 'null' now though - just need to get alternate_languages sorted now please - this is causing me a lot of headaches for single page types!

1 Like

Hi @dmakos ,

I'm sorry to see this isn't working with alternate_languages. The team is investigating and I'll update the thread when I have more information.

Best,
Guy

1 Like

Hi @guy.proops ,
Is there any update for this please? Thanks :slight_smile:

Hi @dmakos , to fix this for alternate_languages is more complex than initially anticipated.

It will introduce the following breaking change to the API.
Before: If you had at some point in time a UID in your custom type and then removed it, the document will keep its UID forever.
After: The UID is removed from the document.
The breaking change is that some users may have written code assuming that the UID is always there even if it should always have been considered optional.

As a first step, we need to study the impact to see how many users this affects. Once we have more data, we'll be able to update you with what the next steps are.