8000 feat: ✨ use connection api for opting in to dynamic rendering by HofmannZ · Pull Request #164 · expatfile/next-runtime-env · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: ✨ use connection api for opting in to dynamic rendering #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

HofmannZ
Copy link
Member

BREAKING CHANGE: The unstable_noStore API has been removed from Next.js, use the connection API to opt in to dynamic rendering.

BREAKING CHANGE: The `unstable_noStore` API has been removed from Next.js, use the `connection` API to opt in to dynamic rendering.
@HofmannZ HofmannZ requested a review from Copilot March 10, 2025 14:31
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }) => {

@itaru2622
Copy link
itaru2622 commented Apr 29, 2025

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.
my fixing branch is: https://github.com/itaru2622/next-runtime-env/tree/fix-nextjs-15-compatibility
based on this PR branch, i.e. @HofmannZ/feature/nextjs-15-compatibility branch

I pushed PR #181 into this branch.

 PASS  src/utils/make-env-public.spec.ts
 PASS  src/helpers/get-public-env.spec.ts
 PASS  src/script/env.spec.ts
 PASS  src/provider/env-provider.spec.tsx
 PASS  src/helpers/log.spec.ts
 PASS  src/script/env-script.spec.tsx
 PASS  src/provider/use-env-context.spec.tsx
 PASS  src/script/public-env-script.spec.tsx
 PASS  src/provider/public-env-provider.spec.tsx

Test Suites: 9 passed, 9 total
Tests:       1 todo, 36 passed, 37 total
Snapshots:   0 total
Time:        3.868 s
Ran all test suites.

@danfarewell
Copy link

Any updates here?

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.

3 participants
0