Upgrade to slice-machine-ui v.1.0 lost all slice data

Hey,

I have just upgrade to slice-machine-ui to v.1.0 and it seems that after I had push my content type to prismic, I lost all slice data...

https://tinyurl.com/2ffxy9r7

I wonder if there is a conflict between legacy builder content type json and slice machine json.

Please help me recover my data ! :pray:

Ok I manage to fix this by myself.. turns out that the json key for the «slices» object was changed from «body» to «slices» and this was causing the slice data not apply to content type slices pages.

I wonder what cause this and how I can avoid this if want to upgrade to slice-machine v1.5.
Can you help me to understand what cause this bug ?

This was very frightening :sweat_smile:

1 Like

Thanks for sharing your solution @poisson.miel!

@Pau do you have an idea what cause this and how I can prevent this to happen again ? I would like to migrate slice-machine v1.5.1 but I am afraid that this could happen again.

Its difficult to pinpoint the exact cause. The best option is always to keep Slice Machine's version up to date. This ensures that you benefit from any bug fixes and enhancements that have been released.

Overall, also staying engaged with the Prismic community are good practices to help prevent and mitigate potential issues.

Ok, I manage to upgrade slice-machine to v1.6 without data loss. It was not easy an easy process tough, I would have nice to have an upgrade guide.

Hello there! Where did you change the json key to resolve this? As in, which file? Thank you!

Hi @robert.r.peterson ,

This would be in the JSON files for your types in the customtypes folder.

You can see an example here in this sample project:

Thanks.

1 Like

Phil, thanks for the reply! I actually realized that soon after posting, but even after editing the index.json files to rename "body" as slices and pushing to my Prismic repo, my Slice data didn't reappear.

Here's what I'm trying to do:

I've got a repo that I need to upgrade to the new Slice Machine and Page Builder.

Previously, I upgraded the page builder, then carried out the Slice Machine uprgrade. Everything seemed to work out fine.

Recently, I've tried to carry out the same process, but this time I lost my Slice data.

I hadn't yet upgraded my Page Buider when I carried out the Slice Machine upgrade — could that have disrupted the process?

Thank you!

Upgrading to page builder will have no effect on what you're seeing here.

There are 2 things I can think of here.

  1. You pushed a custom type that changed the name of the slices to body, then republished a document. If you did this then unfortunately, the API has been updated, and your content is lost.
  2. Maybe the API ID of your Slice Zone wasn't slices, if you haven't republished and can still see the Slice data in the API, then checking the API browser for the correct API ID of the Slice Zone will allow you to update the Custom Type JSON correctly and get your data in the editor back. If it was an older custom type it is most likely actually called body and this is what you should have in the custom type.

Let me know what you see in the API and we'll work from there.

1 Like

Phil — thanks so much for the reply. I can confirm that this was indeed an older custom type, with the array called "body." I've also tried creating new content items (in the new page builder with the new slice machine) and that part of the data model is still called "body."

One thing I'm confused about — in this process, I didn't unpublish or publish anything. The documents all remained in the published state.

I'll attempt the upgrade process again and let you know on this thread. I really appreciate your time and expertise!

EDIT: Here's some more background. In my "origin" data model, the body array lives at the "top":

{
    "uid": "uid-here",
   
    "body": [
        {

}

But in the target version — this is what I saw after upgrading everything — the body array had been moved "down" into the a "data" array, which is new:

{
    "id": "YVtTfxEAACgAYGKU",
    "uid": "uid",
    "url": null,
   
    "data": {
        "body": [
            {
                "id": "paragraph$458c7b08-b318-4aa7-9e7e-c1bf52dd2e34",
                "slice_type": "paragraph",
                "slice_label": null
            }
        ],

This might be the cause of the problem, all right. Try reverting to the older model to see if you data reappears.