Next.js Discord

Discord Forum

use cache working in dev, not prod

Unanswered
Band-tailed Pigeon posted this in #help-forum
Open in Discord
Band-tailed PigeonOP
"use cache";

import { cacheLife } from "next/cache";
import { redirect } from "next/navigation";

export default async function Home({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  cacheLife("max");
  ...

14 Replies

Band-tailed PigeonOP
To add more
in dev mode, when i navigate between links, it is instant
but when in production i keep on seeing skeleton loading as if no cache
Band-tailed PigeonOP
i did pnpm start
 cacheComponents: true,
i do have a client component in my layout.tsx but it is in a separate file, imported into layout.tsx
even i iremove the client component, the issue persists
Band-tailed PigeonOP
ok the problem is with using params
now cant think of another way
docs stated search params, not dynamic route ones
Band-tailed PigeonOP
update
i used export function generateStaticParams() {
its fixed now
would appricate other solutions to this
coz generateStaticParams aint dynamic