Skip to content

Commit 2a013e0

Browse files
committed
docs: update content-source-maps-graphql example
1 parent 8fa984c commit 2a013e0

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { draftMode } from 'next/headers';
22

33
export async function GET(request: Request) {
4-
draftMode().disable();
4+
(await draftMode()).disable();
55
return new Response('Draft mode is disabled');
66
}

examples/content-source-maps-graphql/app/api/enable-draft/route.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export async function GET(request: Request) {
1717
}
1818

1919
// Enable Draft Mode by setting the cookie
20-
draftMode().enable();
20+
(await draftMode()).enable();
2121

2222
// Override cookie header for draft mode for usage in live-preview
2323
// https://github.com/vercel/next.js/issues/49927
24-
const cookieStore = cookies();
24+
const cookieStore = await cookies();
2525
const cookie = cookieStore.get('__prerender_bypass')!;
26-
cookies().set({
26+
(await cookies()).set({
2727
name: '__prerender_bypass',
2828
value: cookie?.value,
2929
httpOnly: true,

examples/content-source-maps-graphql/app/layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export const metadata: Metadata = {
77
description: 'Generated by create next app',
88
};
99

10-
export default function RootLayout({
10+
export default async function RootLayout({
1111
children,
1212
}: Readonly<{
1313
children: React.ReactNode;
1414
}>) {
15-
const { isEnabled } = draftMode();
15+
const { isEnabled } = await draftMode();
1616

1717
return (
1818
<ContentfulPreviewProvider

examples/content-source-maps-graphql/app/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { draftMode } from 'next/headers';
22
import { getAllPostsForHome } from '../lib/api-graphql';
33

44
export default async function Home() {
5-
const { isEnabled } = draftMode();
5+
const { isEnabled } = await draftMode();
66
const posts = await getAllPostsForHome(isEnabled);
77

88
return (
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
{
22
"private": true,
33
"scripts": {
4-
"dev": "next dev",
4+
"dev": "next dev --turbopack",
55
"build": "next build",
66
"start": "next start"
77
},
88
"dependencies": {
9-
"@contentful/live-preview": "^4.2.2",
9+
"@contentful/live-preview": "^4.6.0",
1010
"@types/node": "20.2.3",
11-
"@types/react": "18.2.7",
12-
"@types/react-dom": "18.2.4",
11+
"@types/react": "19.0.1",
12+
"@types/react-dom": "19.0.1",
1313
"graphql-request": "^6.1.0",
14-
"next": "14.2.10",
15-
"react": "18.2.0",
16-
"react-dom": "18.2.0",
14+
"next": "15.0.4",
15+
"react": "19.0.0",
16+
"react-dom": "19.0.0",
1717
"typescript": "5.0.4"
18+
},
19+
"overrides": {
20+
"@types/react": "19.0.1",
21+
"@types/react-dom": "19.0.1"
1822
}
1923
}

0 commit comments

Comments
 (0)