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:
+2
-2
@@ -17,9 +17,9 @@ export const metadata: Metadata = {
|
||||
};
|
||||
|
||||
export default async function AgbPage() {
|
||||
const page = await getLegalPage("agb");
|
||||
const headings = page ? extractHeadings(page.content) : [];
|
||||
const { isEnabled: isPreview } = await draftMode();
|
||||
const page = await getLegalPage("agb", { draft: isPreview });
|
||||
const headings = page ? extractHeadings(page.content) : [];
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user