mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? Ignore router prefetch protocol headers when the request is not classified as an RSC request. Add a dedicated force-dynamic App Router fixture that verifies HTML and valid RSC prefetch behavior. ### Why? A non-RSC HTML request with `Next-Router-Prefetch: 1` could enter the partial prefetch tree path, produce a null active cache node, and suspend the HTML render until timeout. ### How? Determine `isRSCRequest` before parsing prefetch modes, then require it for prefetch modes `1`, `2`, and `3`, including route-tree prefetch classification. The regression fixture uses an abort timeout to fail quickly if the HTML response hangs and separately confirms RSC prefetches remain valid. ### Verification - `pnpm build-all` - `NEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-turbo test/e2e/app-dir/non-rsc-router-prefetch/non-rsc-router-prefetch.test.ts` - `NEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-webpack test/e2e/app-dir/non-rsc-router-prefetch/non-rsc-router-prefetch.test.ts` - `pnpm --filter=next types` <!-- NEXT_JS_LLM_PR -->