feat: ✨ use connection api for opting in to dynamic rendering#164
feat: ✨ use connection api for opting in to dynamic rendering#164HofmannZ wants to merge 1 commit intodevelopmentfrom
Conversation
BREAKING CHANGE: The `unstable_noStore` API has been removed from Next.js, use the `connection` API to opt in to dynamic rendering.
There was a problem hiding this comment.
PR Overview
This PR replaces the deprecated unstable_noStore API with the new connection API to opt in to dynamic rendering and updates related configuration and documentation across the codebase. Key changes include:
- Replacing unstable_noStore calls with await connection() in API routes, server pages, and providers.
- Updating Next.js version references and compatibility documentation.
- Adjusting Node.js versions in CI and release workflows.
Reviewed Changes
| File | Description |
|---|---|
| examples/with-app-router-context/next.config.js | Removed experimental config block and added serverExternalPackages. |
| src/script/env.ts | Replaced unstable_noStore call with comments regarding connection API usage. |
| .github/actions/back-merge/action.yml | Updated merge commit message format. |
| examples/with-app-router-context/src/app/api/bar-baz/route.ts | Updated dynamic rendering opt‐in and Next.js version comment. |
| .github/workflows/ci.yml | Updated Node.js matrix versions. |
| examples/with-app-router-context/src/app/server-side/page.tsx | Converted component to async and updated dynamic rendering call. |
| .github/workflows/release.yml | Updated Node.js version in release workflow. |
| README.md | Updated documentation to reflect Next.js 15 compatibility. |
| docs/EXPOSING_CUSTOM_ENV.md | Updated dynamic rendering examples to use connection API. |
| src/provider/public-env-provider.tsx | Converted component to async to await connection(). |
| src/script/public-env-script.tsx | Converted component to async to await connection(). |
| examples/with-app-router-script/next.config.js | Removed Next.js config file for the app router script. |
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (4)
src/script/env.ts:25
- The asynchronous 'connection()' call is commented out while the function remains synchronous. Consider converting the function to async and updating its consumers or removing the commented code to avoid confusion.
// await connection();
README.md:22
- [nitpick] There are duplicate bullet points regarding Next.js 15 compatibility. Consider consolidating these entries to improve clarity.
- **Next.js 15:** Use `next-runtime-env@4.x` for new connection API.
src/provider/public-env-provider.tsx:23
- Async function components should only be used in server components. Please verify that PublicEnvProvider is not used in a client-side context.
export const PublicEnvProvider: FC<PublicEnvProviderProps> = async ({
src/script/public-env-script.tsx:26
- Ensure that making PublicEnvScript asynchronous is appropriate for its usage context, as async React components should only be used in server-rendered components.
export const PublicEnvScript: FC<PublicEnvScriptProps> = async ({ nonce }) => {
|
Hi, @HofmannZ I am a user of next-runtime-env and want to use this next15/react19 supported feature as soon as possible. I could fix the above CI errors with small patch and now passed the test. I pushed PR #181 into this branch. |
|
Any updates here? |
|
Any updates on this? |
BREAKING CHANGE: The
unstable_noStoreAPI has been removed from Next.js, use theconnectionAPI to opt in to dynamic rendering.