The frontent is Next.js, the backend is Django, and we're using the django admin to update information. The info updates just fine on static pages, but on dynamic routes it won't update.
This is what the code looks like on the dynamic route pages on the getStaticPaths and getStaticProps in Next.js:
export async function getStaticPaths() {
const response = await fetch(
`${process.env.NEXT_PUBLIC_BASE_CMS}/api/events/all`,
);
let events;
if (response.status === 200) {
events = await response.json();
}
const paths = events?.map((event) => ({
params: { id: `${event?.id}` },
}));
return {
paths,
fallback: false,
};
}
export async function getStaticProps({ params }) {
const response = await fetch(
`${process.env.NEXT_PUBLIC_BASE_CMS}/api/events/one/${params.id}`,
);
let event;
if (response.status === 200) {
event = await response.json();
}
return { props: { event: event?.event || null }, revalidate: 10 };
}
I thought adding the 'revalidate:10' would fix the issue, but so far it seems to be continuing, and in order for the changes to show up we have to redeploy every time changes are made to the backend, which isn't ideal.
Any help would be appreciated, thank you!