fix(cms-contentful): await draftMode() and use Promise<> params type#95631
Merged
icyJoseph merged 6 commits intoJul 20, 2026
Merged
Conversation
icyJoseph
reviewed
Jul 9, 2026
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
icyJoseph
approved these changes
Jul 20, 2026
Contributor
Stats skippedCommit: 1f8a9d2 |
Contributor
Tests PassedCommit: 1f8a9d2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fix the
cms-contentfulexample to use the async APIs introduced in Next.js 15:draftMode()inapp/page.tsx,app/posts/[slug]/page.tsx, andapp/api/disable-draft/route.tsparamstype toPromise<{ slug: string }>and await it inapp/posts/[slug]/page.tsxWhy?
In Next.js 15,
draftMode()fromnext/headersbecame async and must be awaited.Page
paramsare also now typed as aPromise. The example was using the oldsynchronous 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 theparamstype signature toPromise<{ slug: string }>with a correspondingawait.Closes NEXT-
Fixes #