Fix: css in next/dynamic component in edge runtime (#64382)#1
Fix: css in next/dynamic component in edge runtime (#64382)#1MitchLewis930 wants to merge 1 commit intopr_031_beforefrom
Conversation
### 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
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
PR_031
PR Type
Bug fix
Description
Wrap async local storage for edge runtime request handlers
Fix CSS imports in next/dynamic components on edge runtime
Update PreloadCss to pass context identifier to getExpectedRequestStore
Add test coverage for edge runtime CSS loading
Diagram Walkthrough
File Walkthrough
adapter.ts
Wrap edge runtime handlers with async storagepackages/next/src/server/web/adapter.ts
RequestAsyncStorageWrapperhandlers
preload-css.tsx
Pass context identifier to request store getterpackages/next/src/shared/lib/lazy-dynamic/preload-css.tsx
getExpectedRequestStorecall to pass context identifier'next/dynamic css'
page.js
Add edge runtime test pagetest/e2e/app-dir/dynamic-css/app/ssr/edge/page.js
index.test.ts
Add edge runtime CSS loading testtest/e2e/app-dir/dynamic-css/index.test.ts