File tree 5 files changed +18
-14
lines changed
examples/content-source-maps-graphql
5 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 1
1
import { draftMode } from 'next/headers' ;
2
2
3
3
export async function GET ( request : Request ) {
4
- draftMode ( ) . disable ( ) ;
4
+ ( await draftMode ( ) ) . disable ( ) ;
5
5
return new Response ( 'Draft mode is disabled' ) ;
6
6
}
Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ export async function GET(request: Request) {
17
17
}
18
18
19
19
// Enable Draft Mode by setting the cookie
20
- draftMode ( ) . enable ( ) ;
20
+ ( await draftMode ( ) ) . enable ( ) ;
21
21
22
22
// Override cookie header for draft mode for usage in live-preview
23
23
// https://github.com/vercel/next.js/issues/49927
24
- const cookieStore = cookies ( ) ;
24
+ const cookieStore = await cookies ( ) ;
25
25
const cookie = cookieStore . get ( '__prerender_bypass' ) ! ;
26
- cookies ( ) . set ( {
26
+ cookieStore . set ( {
27
27
name : '__prerender_bypass' ,
28
28
value : cookie ?. value ,
29
29
httpOnly : true ,
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ export const metadata: Metadata = {
7
7
description : 'Generated by create next app' ,
8
8
} ;
9
9
10
- export default function RootLayout ( {
10
+ export default async function RootLayout ( {
11
11
children,
12
12
} : Readonly < {
13
13
children : React . ReactNode ;
14
14
} > ) {
15
- const { isEnabled } = draftMode ( ) ;
15
+ const { isEnabled } = await draftMode ( ) ;
16
16
17
17
return (
18
18
< ContentfulPreviewProvider
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { draftMode } from 'next/headers';
2
2
import { getAllPostsForHome } from '../lib/api-graphql' ;
3
3
4
4
export default async function Home ( ) {
5
- const { isEnabled } = draftMode ( ) ;
5
+ const { isEnabled } = await draftMode ( ) ;
6
6
const posts = await getAllPostsForHome ( isEnabled ) ;
7
7
8
8
return (
Original file line number Diff line number Diff line change 1
1
{
2
2
"private" : true ,
3
3
"scripts" : {
4
- "dev" : " next dev" ,
4
+ "dev" : " next dev --turbopack " ,
5
5
"build" : " next build" ,
6
6
"start" : " next start"
7
7
},
8
8
"dependencies" : {
9
- "@contentful/live-preview" : " ^4.2.2 " ,
9
+ "@contentful/live-preview" : " ^4.6.0 " ,
10
10
"@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 " ,
13
13
"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" ,
17
17
"typescript" : " 5.0.4"
18
+ },
19
+ "overrides" : {
20
+ "@types/react" : " 19.0.1" ,
21
+ "@types/react-dom" : " 19.0.1"
18
22
}
19
23
}
You can’t perform that action at this time.
0 commit comments