Hello,
I am working on a project with Next JS and Prismic.
I need to fetch all pages of a custom type to pass it in a component that will list a link toward every single page of this type of custom type.
Here's the getStaticProps:
export async function getStaticProps({ previewData }) {
const client = createClient({ previewData })
const page = await client.getSingle('jobs_main')
// const pillarPages = await client.getAllByType('pillar_page')
const pillarPages = await fetchPillarPages(client)
return {
props: {
metaTitle: page.data.meta_title,
metaDescription: page.data.meta_description,
title: page.data.title,
ogImage: page.data.og_image.url,
page: page,
pillarPages: pillarPages
}
}
}
My issue is that since I have 100+ pillar_page, the data loaded for the page containing the component is super heavy: Warning: data for page "/xx" is 1.38 MB which exceeds the threshold of 128 kB, this amount of data can reduce performance.
As I am already fetching at build time, how could I reduce the size?
Best,
Thanks!