Hi I managed to get my slices to work with content relationships but slice simulator isn't receiving this data so I can't preview data or get screenshots.
I have a testimonials slice that pulls in data from a testimonials custom type.
I am using Prismic with NextJS.
My homepage is coded like this.
import { createClient } from '../prismicio';
import { SliceZone } from '@prismicio/react';
import { components } from '../slices/index';
import Layout from '../components/Layout';
export default function Home({ layout, home }) {
return (
<Layout layout={layout}>
<SliceZone
slices={home.data.slices}
components={components}
/>
</Layout>
);
}
export async function getStaticProps({ params, previewData }) {
const client = createClient({ previewData });
const layout = await client.getSingle('layout');
const home = await client.getSingle('homepage', {
fetchLinks: 'testimonials.testimonial',
});
return {
props: {
layout,
home,
},
};
}
Mock data for content relationships is not possible in Slice Machine at the moment, the team are planning to work on this very soon. This is being tracked as a feature request here:
For now you will only be able to test this with Published content in your Prismic repository.
With the addition of Live Previews in the Prismic admin this feels more pressing. We've got many slices that are built around content relationships, right now those all just render as blanks or error messages.
Thanks for your message. We are aware of this issue and have it on our list of feature improvement but we can't share an expected release date for now. The team has recently fixed part of this issue when content relationship fields where used to only link internal pages, but we still don't support the usage of content relationship fields that fetch specific data from another document.