Home App Docs Blog Github

Phantom data in content from deleted models

Issue description

Deleting a field in a model is not deleting related data from the content. The data is then still present in the API calls.

Steps to reproduce the issue

  1. Add 2+ fields to a model
  2. Populate an instance of that model so that all the fields have data
  3. Delete one of fields
  4. Check the api data and you will see that the data from that deleted field is still present.

What’s the expected result?

Deleting a field from a model should also delete the relevant data from content that was using that field.

What’s the actual result?

The content from the API still contains the data from the models which have since been deleted.

Additional details / screenshot

Yesterday, about 16-20 hours ago, I was experimenting and created:

  1. A list;
  2. 2 Boolean fields (not contained within this list);

These fields were nested in other models, the hierarchy being:

Data → List → Object

I populated some of the content items using these new fields. I decided to not use these fields and deleted them.

When I check the call on my side, the items are still present. I’ve cleared cache and public folders, and restarted the server multiple times since yesterday.

Deleting an item is probably going to fix it in my current case. However, this is not a good solution as a field could have assets or data that can not easily be reproduced. This can also lead to a lot of unnecessary data that is being pulled from the API which adds unneeded overhead to both my project as well as Builder.io’s API.

Here is a screenshot of an API call where I’ve pointed at the fields that should no longer be present and has been included for the sake of completion.

phantom data builder.io

Hi @martink-rsa ,

Changing a model schema doesn’t apply retroactively on content entries that’s already been created using the old schema, to apply the new schema on old content entries you can use the write API to remove those field values.