How to change Slicemachine storybook snapshot location

So one thing that I've run into being a problem (especially when showcasing slicemachine to clients), is that storybook doesn't yet see relational data - ie, if you have a slice that links to another custom type the data doesn't get pulled through.

this leads to confusion, as many slices end up missing lots of context. And sometimes the automatically generated mock data doesn't really align with the expected content on the page (usually being way too long)

Screenshot captured by slice machine

Screenshot taken manually

I know in slicemachine, it's possible to upload custom screenshots, but going through 50+ variations and manually uploading them each time is slow and has a high potential for error

What's the best way of getting storybook to display these stories with the correct data, and then capture the screenshot automatically with context?

Can I manually overwrite the mocks.json data in slicemachine/assets/slices?
Can I link up the automatic screengrabbing to custom storybook stories?

I know the stories and data are generated automatically, but I'm looking for a way to have a little more control (i'd like to use the storybook mdx documentation feature too) while still retaining the slicemachine functionality

(for context, I'm using nextjs slicemachines 0.1.1)

Hi Dan,

I don't have any complete answers for this yet. I'll get back to you on Monday once I get more information.

Thanks.

1 Like

Hi Dan,

I talked with the team to get some follow up information on your questions.

The issue with manually doing this is that any time you make a change in the Slice editor your mocks will be overwritten and you'll be back to square one.

We've tested this, and while there is no issue connecting a custom story, connecting a custom mock causes issues.

So to answer your main question:

There is no good way of doing this for the moment. I realise how tedious the alternative is for you, but this will be in our plans to implement mocks for content relationships at some point, although it's not being worked on at the moment.

This is a tricky one but the team has it in mind and if they have any updates they'll notify you here.

Thanks.

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.

any update on that?

Hi @jev1,

There's been no change on this one yet. The best option right now is to add custom screenshots.

Thanks.