- 03 Aug, 2026 16 commits
-
-
next-js-bot[bot] authored
-
Joseph authored
- Rework the `/docs/app/api-reference/config/next-config-js/turbopackFileSystemCache` API reference. - Adjust the table notes in `/docs/app/api-reference/turbopack#configuration` — `[^1]` works well, but the table notes are auto-magically placed at the bottom of the page. Going with this hand rolled table notes for now. - Tidy the Build Caching section in `/docs/app/api-reference/turbopack#configuration` - Update the Upgrade to version 16 section on dev/build cache - Removed the `Build caching` from Webpack gaps - Added Filesystem caching to Performance and Fast Refresh
-
Joseph authored
Reworks the instant-navigation guide's e2e testing example to cover both ways a route is reached: a direct visit (SSR document load) and a client navigation. Each test wraps the navigation in `instant()` and asserts the shell renders while the streamed content is held back, then appears after. Also documents where the testing API is available: automatically under `next dev`, and in a production build via `experimental.exposeTestingApiInProductionBuild`. Closes: https://linear.app/vercel/issue/DOC-6477/instant-e2e-helper-for-ssr-and-soft-navs-snippets-show-difference --------- Co-authored-by:
Aurora Scharff <aurora.sofie@gmail.com> Co-authored-by:
Aurora Scharff <66901228+aurorascharff@users.noreply.github.com>
-
Sam Poder authored
Follow-up PR to https://github.com/vercel/next.js/pull/96159, adding an end to end test that specifically tests the new stuff in that PR!
-
Andrew Clark authored
Previously, adding a truthy `instant` config to a route segment (e.g. `export const instant = true`) did two things: it enabled instant navigation validation, and it implicitly opted the route into Partial Prefetching. Now those concerns are fully separate. `instant` only controls validation, so enabling it no longer silently changes how a route is prefetched. Partial Prefetching is enabled with the `prefetch` segment config (`'partial'` or `'unstable_eager'`), or globally with the `partialPrefetching` option in next.config. For routes whose only opt-in was a truthy `instant`, `<Link prefetch={true}>` goes back to performing a legacy full prefetch instead of being downgraded to a partial one. `instant = false` still opts a route out of the dev-time `prefetch={true}` warning. Adds a regression test asserting that a route that only exports `instant = true` keeps the full-prefetch behavior. -
Tim Neutkens authored
## Summary Set `NEXT_PRIVATE_LOCAL_DEV=1` for directory fixtures in deploy mode, matching the next-start setup. This keeps copied test runner files excluded from TypeScript checks when deployment tests use `tsconfig.test.json`. ## Verification - `pnpm exec tsc --project test/lib/tsconfig.json --noEmit` - Not run: deployment tests (requires Vercel deployment credentials) <!-- NEXT_JS_LLM -->
-
Aurora Scharff authored
## Summary - clarify how runtime foundations, interactive workflows, and unattended loops fit into the AI agents and Instant Navigation guides - harden the Cache Components and Partial Prefetching Skills around capability checks, trustworthy `instant()` tests, route scope, and real-app verification failures - add migration-guide comments to temporary Partial Prefetching route config and update `remove-partial-prefetch` to remove only generated comments while preserving runtime-prefetch TODOs and user comments This keeps the experimental Partial Prefetching optimizer in #96471 separate. ## Testing - `pnpm --filter @next/codemod build` - `pnpm --filter @next/codemod test -- transforms/__tests__/remove-partial-prefetch.test.js --runInBand`
-
Marcos Hernanz authored
## What changed Added scoped review guidance under `test/` so Vercel Agent flags changes that newly disable deploy-mode tests or assertions. ## Why Deploy coverage should only be disabled for assertions that are inherently self-hosted-specific. When deployed behavior differs, the test should prefer documenting those semantics instead of skipping deploy mode. ## Validation - `pnpm install --frozen-lockfile` - `pnpm build-all` - Hosted Vercel Agent E2E: an intentional `skipDeployment: true` probe was flagged inline, then removed - Hosted Vercel Agent Review passed on the final diff
-
Joseph authored
Fixes: https://github.com/vercel/next.js/issues/93126, https://github.com/vercel/next.js/issues/95551 Repro: - from `/` navigate to `/abc#foo` - on `/abc#foo` - now click `/abc#bar` - the url is now at `/abc#foo#bar` Unlike, https://github.com/vercel/next.js/pull/93855, this PR fixes what gets stored in the segment cache navigation, rather than slicing away an existing hash. It is plausible that dropping the hash from the segment cache is not desired though.
-
Tim Neutkens authored
## Summary Enable the project-local TypeScript CLI checker by default during `next build`, while preserving `experimental.useTypeScriptCli: false` as an opt-out to the TypeScript compiler API. Update the TypeScript 7 guidance, diagnostics, tests, and documentation to match the new default. ## Verification - `pnpm exec jest --runTestsByPath test/unit/isolated/config.test.ts` - Pre-commit lint-staged checks passed (Prettier and ESLint) - Not run: `pnpm test-start-turbo test/production/app-dir/typescript-cli/typescript-cli.test.ts` (isolated fixture dependency installation was blocked by unavailable npm registry access) - Not run: `pnpm --filter=next types` (repository has pre-existing unrelated TypeScript errors) <!-- NEXT_JS_LLM -->
-
Zack Tanner authored
## Summary The `pages-router-app-not-found` test verifies behavior implemented by the Next.js adapter. The legacy `@vercel/next` builder has a pre-existing behavior where it prefers the Pages Router error page for this hybrid routing case. Skip this test when deployment tests run without the adapter. It will continue running in development, `next start`, and adapter deployment tests. ## Verification - `NEXT_TEST_MODE=deploy NEXT_ENABLE_ADAPTER=0 pnpm testheadless test/e2e/app-dir/pages-router-app-not-found/pages-router-app-not-found.test.ts` - `pnpm testheadless test/e2e/app-dir/pages-router-app-not-found/pages-router-app-not-found.test.ts`
-
Joseph authored
App Shell upgrade for prerendered fallbacks, are now gated behind `partialPrefetching`.
-
David Alexandru Ilie authored
## Summary - Treat the root `scroll-padding-top` as the lower boundary of the usable viewport during App Router navigations, so content obscured by a sticky header is not incorrectly considered visible. - Preserve the merged Fragment scroll-ownership state machine: empty Fragments remain unavailable targets, while real targets are classified against the padding-aware viewport. - Resolve pixel and percentage values and use the same visibility rule in both the legacy element handler and the Fragment-ref handler. - Add regression coverage showing that Next scrolls when the destination is hidden inside the padding boundary, while preserving the current scroll position when the destination is genuinely visible below it. ## Performance The root computed style is resolved lazily, only after the candidate produces client rects. Empty Fragments and hash navigations do not perform this lookup. For a real route-scroll target, the resolved value is cached locally and reused by the second geometry check after `scrollTop = 0`. This does not add work to scroll events or every render, and keeping the value local allows responsive CSS, root classes, and custom properties to change between navigations. In a 50-iteration dirty-style Chromium probe, both the existing and updated paths reported 50 style recalculations and 50 layouts, indicating that the lookup reused the style/layout update already required by the handler in that test. ## Related work #96342 is now merged into `canary` and handles empty Fragment scroll ownership. This PR composes with its `NoClientRects` / `InViewport` / `OutOfViewport` state machine by changing only the visible-region boundary for real targets. ## Verification - `HEADLESS=true pnpm test-dev-turbo test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts -t "scroll padding"` (3/3) - `HEADLESS=true __NEXT_EXPERIMENTAL_APP_NEW_SCROLL_HANDLER=false pnpm test-dev-turbo test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts -t "scroll padding"` (3/3) - `HEADLESS=true pnpm test-dev-turbo test/e2e/app-dir/parallel-routes-scroll-owner/parallel-routes-scroll-owner.test.ts` (8/8) - `HEADLESS=true pnpm test-dev-webpack test/e2e/app-dir/parallel-routes-scroll-owner/parallel-routes-scroll-owner.test.ts` (8/8) - `HEADLESS=true pnpm test-dev-turbo test/e2e/app-dir/navigation-focus/navigation-focus.test.ts` (5/5) - Manually compared the same sticky-header reproduction before and after the change. <!-- NEXT_JS_LLM -->
-
Hendrik Liebau authored
The "Test new and changed tests when deployed" jobs install Next.js from the preview tarballs built for the commit under test, but nothing made them wait for those tarballs to exist. Until #96438 the job was ordered behind `test-prod` and the other new-test jobs, which delayed it long enough that the tarballs had usually landed by the time it looked for them. Now that it starts immediately it frequently fails with "Artifacts not found for commit ...". The ordering cannot be expressed as a `needs:` entry, because the tarballs are published by a different workflow and, for pull requests from branches in this repository, a different event than the `build-and-test` run that consumes them. We therefore add a `wait-for-preview-tarball` job that polls for the tarball instead, and make both deploy test jobs depend on it. Doing the waiting in one cheap job keeps the deploy test matrices off their 16-core runners until there is something for them to install. The new job is also listed in `tests-pass`. A dependency failure skips the jobs that need it, and a skipped job does not count as a failure, so without that entry a tarball that never arrives would have let the required check pass with the deploy tests never having run. `test-new-tests-deploy-cache-components` gets the same treatment, dropping the incidental ordering it still inherited from `test-cache-components-prod` and picking up the docs-only guard that `test-new-tests-deploy` already had.
-
Steven authored
Regenerate the lockfile to test if the previous PR still works with the latest sharp - https://github.com/vercel/next.js/pull/94845
-
Janka Uryga authored
Closes #96339 Caches that started filling after a prerender was aborted would produce an empty stream, because an aborted `renderSignal` made [the signal we pass to `prerender()` inside `use-cache-wrapper`] be aborted immediately. So we produced an empty entry and saved it, essentially poisoning the cache. Fixed by removing `renderSignal` from the `AbortSignal.any(...)` we pass in and returning a rejected promise before we get to the cache filling codepath. This should not be observable to userspace because the prerender is already aborted.
-
- 02 Aug, 2026 2 commits
-
-
next-js-bot[bot] authored
-
Tim Neutkens authored
## Summary Enable `experimental.turbopackFileSystemCacheForBuild` by default in all environments, including generic CI. Explicitly setting the option to `false` remains the opt-out. Update the focused coverage and documentation to match. ## Verification - `IS_TURBOPACK_TEST=1 pnpm test-start-turbo test/e2e/filesystem-cache/build-cache-default.test.ts` - `pnpm prettier --with-node-modules --ignore-path .prettierignore --check packages/next/src/server/config-shared.ts test/e2e/filesystem-cache/build-cache-default.test.ts docs/01-app/03-api-reference/08-turbopack.mdx docs/01-app/03-api-reference/05-config/01-next-config-js/turbopackFileSystemCache.mdx` - Not run: `pnpm --filter=next build` (the checkout has 11 pre-existing TypeScript errors in unrelated files) <!-- NEXT_JS_LLM -->
-
- 01 Aug, 2026 2 commits
-
-
next-js-bot[bot] authored
-
Hendrik Liebau authored
-
- 31 Jul, 2026 16 commits
-
-
Zack Tanner authored
## Summary When Pages Router and App Router routes coexist, a Pages Router route that returns `notFound` will internally hand rendering to the App Router not-found page. Next.js [prefers the App Router `/_not-found` entry for 404 responses](https://github.com/vercel/next.js/blob/5f5e4773bbb54f19697063ea093e8d89ca7d081a/packages/next/src/server/base-server.ts#L2965-L2980) before falling back to a Pages Router `/404` page. When deployed via an adapter, this means it would have attempted to resume the Pages entry, which wouldn't contain the relevant prerendered shell or postponed state. If the not-found page suspends, its response cannot be resumed using the metadata associated with the Pages Router output. For adapter requests, this marks the handoff with an empty postponed state. This uses the existing resume protocol to perform a complete, non-cacheable dynamic render. `next start` continues to use the normal PPR path, where it can load and resume the App Router not-found output directly. This trades PPR shell reuse for correctness only during this cross-router not-found handoff. Longer term, adapters should have an explicit contract for cross-output handoffs so they can select and resume the App Router not-found output normally, without necessarily declaring the pages router output PPR-capable. The change also documents the empty postponed-state contract and adds deployment regression coverage. ## Verification - Added an end-to-end test that verifies a Pages Router `notFound` response includes the dynamic App Router not-found content when deployed. - `pnpm testheadless test/e2e/app-dir/pages-router-app-not-found` - `pnpm --filter=next types` <!-- NEXT_JS_LLM -->
-
next-js-bot[bot] authored
-
Zack Tanner authored
## Summary [PR #96354](https://github.com/vercel/next.js/pull/96354) changed `retry()` to enforce its duration as a wall-clock budget instead of effectively treating it as a retry count. This exposed the test’s previous two-second budget, which did not reliably cover the intentional one-second `after()` delay plus deployment and ISR latency. Separates the callback delay from the ISR settling timeout and waits for timestamp reads to stabilize before establishing a baseline. <!-- NEXT_JS_LLM -->
-
Marcos Hernanz authored
## Summary Adds one protected `pull_request_target` workflow for advisory automated review of non-draft, member-authored PRs. The existing Vercel reviewer runs Codex, Claude, and synthesis with read-only GitHub access. This base-owned workflow treats that result as untrusted, validates it, and owns the only GitHub mutation. ## Write boundary - no checkout, PR code execution, dependency installation, Actions secrets, or shell interpolation - globally empty permissions; the job has only OIDC and pull-request read - exact repository, event, author association, PR state, base SHA, and head SHA validation - final read-only PR revalidation immediately before publishing - HTML comments stripped, mentions neutralized, token patterns redacted, and output capped at 48 KB - a write token is minted only after validation - exactly one top-level comment `POST` or `PATCH` - existing comments are eligible only when attributed to one of gh-sts's immutable `general` GitHub App IDs and begin with the fixed marker - both actions are pinned to immutable commit SHAs The workflow intentionally runs once on `opened` or `ready_for_review`; it does not run on `synchronize`. ## Validation - `actionlint` - Prettier - syntax validation of all three embedded `github-script` programs - upstream commit verification for both pinned actions - independent Codex and Claude autoreview The workflow remains inert until the matching gh-sts policy is approved.
-
Sam Poder authored
Pulled out of https://github.com/vercel/next.js/pull/96398, wanted to edit this a bit before pushing.
-
Sebastian "Sebbie" Silbermann authored
Saves a click. These PRs still require approval as per repo settings. The commit description is empty so that the React PRs aren't mentioned again in commits. That'd be pretty noisy for the React PRs.
-
Sebastian "Sebbie" Silbermann authored
These are equally important if not more important (since they test build adapters) than next-start tests so we now run them immediately instead of waiting for test-prod. They job is now skipped entirely for docs changes. Which saves a few seconds for docs-only changes.
-
Vercel Release Bot authored
Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
Sam Poder authored
#95261 began to set `module_chunks` on browser chunks so that we can track components this meant that chunks stopped always being plain path strings: ```rust if included.is_empty() && excluded.is_empty() && module_chunks.is_empty() { return EcmascriptChunkData::Simple(path); // bare string } EcmascriptChunkData::WithRuntimeInfo { .. } // object ``` This broke workers when I was testing on `vercel/front`. -
Tobias Koppers authored
### What? Makes `experimental.turbopackFileSystemCacheForBuild` (Turbopack's on-disk filesystem cache for `next build`) enabled by default, matching the dev-mode flag. It stays disabled by default in non-Vercel CI environments, and can always be turned off explicitly with `experimental.turbopackFileSystemCacheForBuild: false`. ### Why? The build filesystem cache greatly speeds up warm builds, but was previously opt-in (only auto-enabled for canary builds on the Vercel builder). Defaulting it on gives everyone faster subsequent builds, while keeping it off in non-Vercel CI where the cache is unlikely to persist between builds. ### How? - `turbopackFileSystemCacheForBuildDefault()` now returns `true` except when `isCI && !NOW_BUILDER` (removed the `isStableBuild()` gate). - The explicit `false` opt-out already works via the existing `config.experimental?.turbopackFileSystemCacheForBuild || false` read. - Adds an e2e test (`test/e2e/app-dir/turbopack-fs-cache-build-default`) asserting `.next/cache/turbopack` is written by default, empty when the flag is `false`, and empty in non-Vercel CI. - Updates the `turbopackFileSystemCache` / Turbopack docs. <!-- NEXT_JS_LLM --> --------- Co-authored-by:
vercel-fleet[bot] <308483924+vercel-fleet[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
An unhandled rejection was previously logged by up to three independent process listeners at once: the render runtime's crash-prevention handler in `process-error-handlers.ts` (a bare `console.error`), the router server's `Log.error('unhandledRejection: ', err)`, and the dev server's `logErrorWithOriginalStack`. The runtime handler must exist on every deployment target (#77997), but on self-hosted `next start`/`next dev` it shares a process with the router server's and dev server's listeners, so a single rejection was logged multiple times in different formats. THe first commits adds a test showing the current behavior where we log multiple times. The second commit introduces `registerUnhandledRejectionListener` and `isUnhandledRejectionListenerRegistered` in `process-error-handlers.ts`, and converts the router server and dev server to check-then-register instead of installing their own rejection loggers: - The listener function is shared via a `Symbol.for` key on `globalThis`, so multiple copies of the module (e.g. in the pre-compiled server bundle and in a route module bundle) register and detect a single listener instance. - The registration check queries `process.listeners('unhandledRejection')` instead of a module-global flag, so it stays accurate even after external code calls `process.removeAllListeners`. `installProcessErrorHandlers` therefore calls the register function unconditionally. The `uncaughtException` handlers are left as they are; they have the same duplication and could be consolidated the same way in a follow-up. -
Zack Tanner authored
## Summary Fix the build output for App Router `not-found` routes that get partially prerendered when cacheComponents is enabled. Previously, Next.js treated any statically generated `/_not-found` route as a complete static 404, even when it contained postponed state. It copied the partial HTML shell to `server/pages/404.html` and omitted the corresponding `/_not-found` prerender from adapter outputs. This change distinguishes fully static not-found routes from partially prerendered ones. Fully static routes retain the existing `404.html` behavior, while PPR routes remain resumable prerender outputs. This allows a `not-found.tsx` that suspends under Cache Components to render its dynamic content when deployed. Closes https://github.com/vercel/next.js/pull/96399 ## Testing Expanded `not-found-non-document-dynamic` coverage to verify that: - dynamic not-found content renders for ordinary missing paths - dynamic not-found content renders when `/_not-found` is selected by a rewrite - a PPR not-found does not emit `server/pages/404.html` - its adapter output includes `PARTIALLY_STATIC` metadata, postponed state, and a resume chain Also verified that fully static App Router not-found routes continue to emit and serve `pages/404.html`. - `__NEXT_CACHE_COMPONENTS=true pnpm test-start-turbo test/e2e/app-dir/not-found-non-document-dynamic/not-found-non-document-dynamic.test.ts` - `pnpm test-start-turbo test/e2e/app-dir/not-found/basic/index.test.ts`
-
Sebastian "Sebbie" Silbermann authored
-
Sam Poder authored
Built using @sokra's Fleet! This re-arranges all of our chunking experimental features under `experimental.turbopackChunking` and adds the following options: ```javascript /** * Avoid creating more than one chunk smaller than this size, in bytes. Smaller * chunks are merged into bigger ones to avoid that. Defaults to `50000` (50 KB). */ minChunkSize?: number /** * Avoid creating more than this number of chunks per chunk group. Chunks are * merged into bigger ones to avoid that. Defaults to `40`. */ maxChunkCountPerGroup?: number /** * Never merge chunks bigger than this size, in bytes, with other chunks. This keeps code * in big chunks from being duplicated across multiple chunks. Defaults to `200000` (200 KB). */ maxMergeChunkSize?: number /** * Minimum size, in bytes, for a component chunk to be emitted on its own when * `generateComponentChunks` is enabled. Component chunks smaller than this are folded into a * single remainder chunk. Defaults to `20000` (20 KB). */ minComponentChunkSize?: number ```
-
Andrew Clark authored
When a static fallback shell is served as-is — e.g. from a CDN in a deployed environment — the client can't hydrate from inline Flight data; it fetches the full RSC payload separately and reconstructs the initial payload on the client. During that reconstruction, the head's partiality flag was accidentally set to the head itself. Since the head is always truthy, the head was unconditionally treated as partial. This happens to be unobservable today: the only flows that reach the reconstruction are fallback-shell prerenders, where the server pessimistically marks the head partial anyway, and when Cache Components is enabled the client ignores the per-payload flag entirely in favor of response-level partiality. But we're about to rework the RSC response format so that head partiality has a single, load-bearing source of truth, so the flag needs to survive the reconstruction correctly rather than by coincidence. While auditing the payload consumers, I also fixed the payload shape check in segment prefetch generation (it used `&&` where `||` was intended, so it accepted any shape) and deleted `should-hard-navigate.ts`, which no longer has any callers on the client. Adds e2e coverage asserting that metadata survives hydrating a fallback shell page: the title is correct after hydration, the head is included in prefetched data, and a return navigation is served entirely from the cache that was populated during initial hydration. In deployed environments this exercises the client resume path, which is where the reconstruction runs.
-
- 30 Jul, 2026 4 commits
-
-
next-js-bot[bot] authored
-
Sam Poder authored
Closes https://github.com/vercel/next.js/issues/96333 by re-ordering the statements in `get_side_effect_free_declaration`. The rest of this PR is then a test + adding to a test fixture. This seems like a reasonable change to me as we'd match Webpack's behaviour. --------- Co-authored-by:
Luke Sandberg <lukesandberg@users.noreply.github.com>
-
Sam Poder authored
At the time we had assumed that these components would not be helpful, however, things can get put in the remainder that can be used on other routes so it is worthwhile to keep track of them.
-
Will Binns-Smith authored
This updates to nightly-2026-07-29 --------- Co-authored-by:
vercel-fleet[bot] <308483924+vercel-fleet[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
-