BUG - Slice Labels are being deleted

This thread is being monitored as an open ticket in the internal Prismic issue tracker. The Prismic support team will update this post as we get more information from our dev team. If you have a similar use-case, you can ‘Flag’ this topic to reopen and add it here.

We are using this feature extensively on a new project for a client. Was not aware that it was buggy until the labels started disappearing.

Disappearing data seems like a critical issue -- is there any ETA on when this bug will be fixed?

Hi Arpan,

I understand that this is frustrating, although this is not something that is likely to be fixed, it's more likely to be deprecated as it has been replaced by the Slice Variations feature using Slice Machine.

When you say "Disappearing data seems like a critical issue", the data doesn't actually disappear until the documents using the Slice have been republished, so if you re-add the label in the Custom Type the data will come back.

Let me know if you have any further questions.

But slice variations aren't available using the regular API, right? It's only available if you are using slice machine with React. So any other framework isn't supported for this.

Or is there a way to use variations over an API with a static site generator like 11ty etc?

The problem with saying that it's simple enough for me or my team to do it. But once we hand this over to the client, they are not going to be able to use the CMS in the way we designed it to work for them. Meaning this will get flagged as a bug and we will be asked to fix it.

The whole reason we are using Prismic is so that a non-technical person will be able to create and manage the content. If this feature is deprecated, it would be good to know -- as we had no idea that was the case.

For now we'll figure out a work around.

In the meantime, is there any plan to support variations over the API or will this only be supported if we use specific libraries?

1 Like

That's correct it's only available for react and vue users in terms of templating right now, the actual Slice (model) could still be built locally and sent to the Prismic repo with Slice Machine, this part is not technology-specific, it just wouldn't generate the code for you.

The Slice Labels feature isn't deprecated, if it was to be deprecated we would give everyone plenty of warning, the issue could be resolved when the team begins its overhaul on the editor. I don't have any confirmation on either of those things.

Issue:
The Slice Labels only disappear when a Custom Type is edited using the visual editor, this is because the Slice Labels can only be edited with the JSON editor. For the moment you'll need to remember to check Slice Labels after editing a Custom Type (I know this is frustrating). So when you hand the content over to the user they shouldn't need to make any changes in the Custom Types becuase it will need to be reflected in the code, so they won't lose their Slice Labels.

Solution:
The most reliable otpion is to use a Select Field as the first field in your Slice instead of Slice Labels. Your user can select what option they want using this field and the Select Field will never disappear as it is built using the Visual Builder. In your code you will use it the exact same way you use Slice Labels.

Thanks.

Yeah, I think that's what I'm going to do - we'll replace all the labels across the site with the select field and update the code to support that.

Thanks for your help.

1 Like

I'll also spend some time exploring slice machine and see if we can integrate it into our process. Thanks.

1 Like

Great, let me know how it goes.

FYI I justed wanted to point out that this bug happens frequently for me as well

Hi Arnor,

Slice Labels have been replaced by Variations which is a fully supported feature without these issues:

Hi Phil, the problem is that there are still customers using the legacy custom type builder and can't migrate over to slice machine. Labels being deleted has been a constant issue over the last 12 months

The most reliable option, in that case, is to use a Select Field as the first field in your Slice instead of Slice Labels. Your user can select what option they want using this field, and the Select Field will never disappear as it is built using the Visual Builder. In your code, you will use it the exact same way you use Slice Labels.

The likelihood is that Slice Labels won't be fixed as they are very low priority since there are workable options in both Slice Machine and the Legacy builder.

I'm going to move for the removal of Slice labels in our docs to stop confusion, as the dropdowns perform the same action.

Thanks Phil. Totally understand what you mean and I've actually been doing this strategy with the select fields for quite some time.

I think the problem comes when there is a client with an existing website which has been built using Slice Labels and the client doesn't have the developer resource to migrate over to Select fields. Now they will need to either spend money to fix something which ultimately is not their fault or continue using Prismic with missing functionality which was there before and working with the risk to potentially break UI elements.

Yes, I agree it can cause issues, and I really wish it didn't.

Hopefully, it can be avoided for most people with user roles in the legacy builder, that way only the dev has access to the types. In Slice Machine since types are now local, this should be the case without user roles.

@Phil sorry to dig up something old, but I thought Slice Machine isn't recommended for in-production repositories just yet?

Hi Scott,

Slice Machine is recommended on production repositories, there are many users already doing so. The thread you linked points out that migrating older Slice models isn't possible yet.

Thanks.

Hey @Phil,

I thought that was the distinction. In-production repositories being those that are already running with the legacy builder and slices, are not recommended for migrating to Slice Machine. New production repositories are fine to go ahead and use it.

Is that accurate?

thanks,
Scott.

Hey Scott, you've summed it up correctly.

1 Like