Seems like our catch-all routes are returning Loading...
on initial page load instead of the actual dom content. Anyone have any ideas on why this is happening?
ah, in your catchall, you need to use extractPlasmicQueryData()
: https://docs.plasmic.app/learn/data-code-components/#using-plasmicappquery
It’s because the Plasmic CMS component is fetching some metadata
there’s no reason we should flash that “Loading…” though… will fix on our side as well
Ahh gotcha, thanks! I was trying to find this, didn’t realize it was under code components
Based on that, this is what I should be updating my getStaticProps
to right?
export const getStaticProps: GetStaticProps = async (context) => {
const { catchall } = context.params ?? {};
const plasmicPath =
typeof catchall === 'string' ? catchall : Array.isArray(catchall) ? `/${catchall.join('/')}` : '/';
const plasmicData = await Plasmic.maybeFetchComponentData(plasmicPath);
const queryCache = await extractPlasmicQueryData(
<PlasmicRootProvider loader={Plasmic} prefetchedData={plasmicData}>
<PlasmicComponent component={plasmicData.entryCompMetas[0].name} />
</PlasmicRootProvider>,
);
if (plasmicData) {
return {
props: {
plasmicData,
queryCache,
},
revalidate: REVALIDATE,
};
} else {
return {
props: {},
};
}
};
yup! and make sure you pass queryCache into your <PlasmicRootProvider/>
in the actual page component as well
sounds good, thanks!
all good and running now!