Next.js Discord

Discord Forum

Content is fully dynamic instead of cached.

Unanswered
Japanese anchovy posted this in #help-forum
Open in Discord
Japanese anchovyOP
My fetch responses on pages that have a {params} prop have recently become dynamic and I've only been facing this issue since yesterday with no changes done to the website.

Here is a snippet of the code:

export default async function PageFetch({
  params,
}: {
  params: { pagenumber: string };
}) {
  const cFetch = await fetch(
    `https://mydomain.com/api/source/${params.pagenumber}`,
    {
      method: "GET",
      next: { revalidate: 86400, tags: ["pagefetch"] },
    },
  );
  const { data: creadores } = await cFetch.json();


I have no issues with the caching behavior once I modify the code and make it static without the params prop as so:

export default async function PageFetch() {
  const cFetch = await fetch(
    `https://mydomain.com/api/source/1`,
    {
      method: "GET",
      next: { revalidate: 86400, tags: ["pagefetch"] },
    },
  );
  const { data: creadores } = await cFetch.json();


I'm using nextJS 14 hosted on vercel. Could somebody please help me fix this issue? Thanks in advance 🙂

1 Reply

Japanese anchovyOP
I downgraded the NextJS version to 14.0.0 from 14.0.2 and it started working again. I'm not sure what change in their update is breaking it.