Skip to content

fix(cms-contentful): await draftMode() and use Promise<> params type#95631

Merged
icyJoseph merged 6 commits into
vercel:canaryfrom
manoraj:manorajk/fix-cms-contentful-draft-mode-params
Jul 20, 2026
Merged

fix(cms-contentful): await draftMode() and use Promise<> params type#95631
icyJoseph merged 6 commits into
vercel:canaryfrom
manoraj:manorajk/fix-cms-contentful-draft-mode-params

Conversation

@manoraj

@manoraj manoraj commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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 #

Comment thread examples/cms-contentful/app/posts/[slug]/page.tsx Outdated
manoraj added 4 commits July 9, 2026 17:30
Address review feedback on the params/draftMode fix: use the
auto-generated PageProps<'/posts/[slug]'> and LayoutProps<'/'> types
instead of hand-written inline types.
…b.com:manoraj/next.js into manorajk/fix-cms-contentful-draft-mode-params
@github-actions

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: 1f8a9d2
View workflow run

@github-actions

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 1f8a9d2

@icyJoseph
icyJoseph merged commit 8669b07 into vercel:canary Jul 20, 2026
57 checks passed
@manoraj
manoraj deleted the manorajk/fix-cms-contentful-draft-mode-params branch July 21, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants