Sorry, this post is a little scattered but I'm kinda feeling around in the dark...
I'm migrating an existing site to slicemachine. I created a new shared component called "Hero" - there was an existing slice on Page called "Hero".
In slicemachine ui - it showed them as 2 separate options
When I pushed the slice, it seems to have replaced the slice, and removed the slices out of the content pages the old one was referenced on. (note i had changed a couple field names, the old fields had underscores which aren't allowed anymore)
Could I get some insight into what's going on behind the scenes so I can plan accordingly?
Does pushing a same-named shared-slice always replace the slice and remove it from all the content that references it?
Do both slices technically exist and one is just hiding? If I rename the new Hero, will the old one still be there?
Hey Beamer, I'll need to reproduce the use case on my end to see if there's a reason for this and/or a workaround to fix it. I'll come back as soon as possible.
Hey there, I can confirm that, for the moment, this is the expected behavior of the Shared Slices library. When you create a Slice with the same name in Slice Machine and in the retro Prismic editor, they will conflict and the one created in Slice Machine will take preference.
I added a feature request to make this clear with a note or warning. Sorry for the inconvenience.
Yes, giving it a totally different name can solve the problem, because it just treats it as a different Slice. You can use the same repository. it is true that migrating from the old editor to the new one is still not a smooth and automated process. We are continuously working to improve this process.
What's the process for renaming a SM slice and renaming it back?
My options how I see it:
Rename Local Slices
Rename my local unpublished slices from { id: "title", name: "Title" } to { id: "sm_title", name: "SMTitle"}
(?) is id the only key that matters to avoid overwriting?
Go through each doc and slowly add the new slices and remove the old ones
(?) Go back and rename the slices? I'm guessing this will cause naming conflicts?
Rename Remote Slices
Rename existing (old) slices in Prismic Title => OldTitle
Publish new sm slices
Go through each doc and slowly add the new slices and remove the old ones
Create new repo and start over
The hardest part with this is moving over the uploaded media - is this something that Prismic can copy to another repo behind the scenes? The content I can recreate, but the images are a pain.
Or duplicate an entire repo, and I'll just delete the old stuff
Is there any insight you have on this @Pau? I don't want to wipe a model or any content during a rename or that'd put me back to square one.
Honestly I only have 10 slices/30 pages, so this isn't a big deal, I just want to figure out the non destructive way to do this, as the project is currently in production
I consider that the easiest way to make the transition from old to new Slices (SM), for now, is to use different names from the beginning. So you don’t need to deal with the tedious process of renaming the ones you’ve already created locally with the Custom types API. And so you can migrate everything in a repository that already has the content.
For the moment there isn't a standardized way of doing these changes.
We don't recommend renaming any model in the json model, the best way of doing this is to name the Slices a different name from the beginning, in Slice Machine. I understand that this may not be ideal in terms of UI, since it doesn't allow you to have the naming conventions you want. But it is the best option at the moment. We even have another open feature request for this: