Fix RSC build break: keep next/headers out of lib/payload.ts

payload.ts's mapping functions/types are also imported by "use client"
components (LiveTestimonialsGrid, LivePostContent) — importing
next/headers anywhere in that module made it unbundlable for the client,
breaking the production build. draftMode() is now only ever called in the
Server Component pages themselves; they pass the resulting boolean into
getPostBySlug/getLegalPage/getTestimonials as a plain `draft` option.
This commit is contained in:
Marco
2026-07-21 19:21:10 +00:00
parent 26ae4a15f4
commit 4f2f137b27
9 changed files with 30 additions and 26 deletions
+1 -1
View File
@@ -39,8 +39,8 @@ export const metadata: Metadata = {
// weekly newsletter), so this page resolves both at once instead of
// picking a new URL and leaving one of them still dangling.
export default async function NewsletterPage() {
const testimonials = await getTestimonials("newsletter");
const { isEnabled: isPreview } = await draftMode();
const testimonials = await getTestimonials("newsletter", { draft: isPreview });
return (
<>