mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
8669b07f19
### What?
Fix the `cms-contentful` example to use the async APIs introduced in
Next.js 15:
- Await `draftMode()` in `app/page.tsx`, `app/posts/[slug]/page.tsx`,
and
`app/api/disable-draft/route.ts`
- Update `params` type to `Promise<{ slug: string }>` and await it in
`app/posts/[slug]/page.tsx`
### Why?
In Next.js 15, `draftMode()` from `next/headers` became async and must
be awaited.
Page `params` are also now typed as a `Promise`. The example was using
the old
synchronous patterns, causing the build to fail and the app to not work
when running against the latest
version of Next.js -- this example project uses latest version of
next.js in the package.json.
### How?
Awaited `draftMode()` at each call site and updated the `params` type
signature to
`Promise<{ slug: string }>` with a corresponding `await`.
Closes NEXT-
Fixes #