Reputation: 2529
I have this website that displays events in a calendar and an event page for each event.
These are my paths and URLs.
/nb/arrangement/en-skole-for-alle
/[lang]/arrangement/[slug]/page
/nb/kalender
/[lang]/kalender/page
This is the relevant part of my revalidate function. It works, I see that it's called correctly. I'm here just desperately trying every permutation to see if my syntax is wrong.
.with({ _type: "event" }, (doc) => {
console.log("/[lang]/arrangement");
revalidatePath("/nb/kalender");
revalidatePath("/nb/kalender/page");
revalidatePath("/nb/kalender/page", "page");
revalidatePath("/[lang]/kalender/page", "page");
revalidatePath("/[lang]/kalender", "page");
revalidatePath("/[lang]/kalender", "layout");
revalidatePath("/nb/kalender", "layout");
revalidatePath("/[lang]/kalender");
revalidatePath(`/nb/arrangement/${doc.slug.current}`);
revalidatePath(`/en/arrangement/${doc.slug.current}`);
console.log("/[lang]/kalender");
revalidatePath("/en/calendar", "page");
console.log("/[lang]");
revalidatePath("/nb", "page");
revalidatePath("/en", "page");
revalidatePath("/", "layout");
return Response.json({ revalidated: true, now: Date.now() });
})
The issue here is that the url/path of the single event gets revalidated correctly (/nb/arrangement/en-skole-for-alle
), but /nb/kalender
won't be revalidated no matter what I try.
Locally (when building and then pnpm start
), it correctly revalidates both pages, but when deployed to Vercel, it won't revalidate this one page.
What is the issue? Any tips on what I can try out?
Upvotes: 0
Views: 4137
Reputation: 37
This issue exists when you try to run client component in server components without defining 'use client' in it
suppose you have -layout ( server component ) -page ( server component ) -page-component ( client component without defining 'use client')
and when you call 'page-component.tsx' in layout or page component it doesn't work well
if you didn't understand let me know
Upvotes: -1
Reputation: 2529
Finally figured it out.
My issue was actually a missing <Suspense>
boundary around useSearchParams()
, which made the "Entire page deopted into client-side rendering". Which then disabled the static page generation and revalidation for this route.
Very sneaky issue to figure ut.
Upvotes: 2