I've recently upgraded to the latest Slice Machine, such that my Custom Types are now saved to the file system in my next.js project, which is great. Everything seems to have gone well, except now that I have synced my content types to Prismic, the "content" that was previously there seems to have disappeared when I try to edit my "Page" Custom Type.
I previously had to select all of my slices in my local Slice machine, so that they are connected to their Custom Types. The slices that I had selected are available to choose from, but none of the ones I that were already being used for content appear any longer. How can I recover this content now?
Hey Michael. Did you migrate the repository from the Legacy builder to Slice Machine? If this was the case, I don't think It'll be possible to recover the content of the documents. This is why we recommend users start using Slice Machine with brand new repositories, we don't currently offer an official migration guide.
Unfortunately, if the content is deleted this way, it cannot be restored. Versioning documents with the history option is only available when the document structure is the same as its past versions:
That's why it's essential to ensure that only the owner or the repository administrators have access to push changes to the repository through Slice Machine or directly on the Custom Types API. Allowing access to publishing rights poses a potential risk of breaking changes if updates are made without the approval of everyone on the team.
To prevent accidental deletion of content in this type of setup, it's important to have a backup system, such as Git. This allows you to easily revert to a previous version of your content in case of accidental deletion or other issues.
Unfortunately, if you didn't created a backup of your past version of the content, it's not possible to restore it.
In reviewing your previous conversation, I noticed that you mentioned using the Legacy Builder. Unfortunately, there is currently no official guide for migrating from the Legacy Builder to Slice Machine. This can make the process difficult as there may be confusing and breaking changes that we cannot avoid at this time.
As a result, we recommend that users either continue using the Legacy Builder for older websites and select Slice Machine for newer projects or attempt to create an identical copy of the older repository manually, if they wish to use Slice Machine for older projects. We understand that this process can be quite time-consuming and is not an ideal solution, but it’s the best option for avoiding content loss.
From what I understood, the issue in your case is that you had existing models and content in a Legacy repository. Then, you recreated all the Content models in Slice Machine and pushed the changes to your repository. This action caused Slice Machine to override all the existing models in the repository. Since the JSON structure differs in Slice Machine for Slices, the content will always be removed. There might be an exception with fields appearing at the Custom Types' top level. If you keep the same API ID for each top-level field, the content should remain there. But this won’t be the case for Slices.
To avoid this error in the future, I will share your use case with the team so that we can consider publishing a public post that explains the dangers of mixing these two tools together.