Skip to content

Comments

Fix: css in next/dynamic component in edge runtime (#64382)#1

Open
MitchLewis930 wants to merge 1 commit intopr_031_beforefrom
pr_031_after
Open

Fix: css in next/dynamic component in edge runtime (#64382)#1
MitchLewis930 wants to merge 1 commit intopr_031_beforefrom
pr_031_after

Conversation

@MitchLewis930
Copy link

@MitchLewis930 MitchLewis930 commented Jan 30, 2026

PR_031


Note

Medium Risk
Touches the core Edge request adapter by changing async storage scoping for all requests, which could affect per-request context propagation. Changes are small and covered by a targeted E2E regression test.

Overview
Fixes next/dynamic CSS preloading in the Edge runtime by ensuring the adapter wraps all requests (not just middleware) in RequestAsyncStorageWrapper, making a request store available during rendering.

Updates PreloadCss to call getExpectedRequestStore('next/dynamic css') (and type the require) for clearer error attribution when invoked outside a request scope, and adds an E2E test route (/ssr/edge) plus coverage to verify only the correct dynamic CSS is applied under Edge runtime.

Written by Cursor Bugbot for commit 56d0988. This will update automatically on new commits. Configure here.

### What

Wrap async local storage for all edge runtime routes in adapter 

Basically fixed the case reported in [this
tweet](https://x.com/keegandonley/status/1778538456458854880)

### Why

We're relying on the ALS for dynamic css preloading but we didn't wrap
the ALS for request handlers for edge. So if you have CSS imports in
`next/dynamic` in edge runtime it would break.

Closes NEXT-3085
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