- 08 Feb, 2026 9 commits
-
-
nextjs-bot authored
-
Ben Brook authored
Co-authored-by:
bencmbrook <7354176+bencmbrook@users.noreply.github.com> Co-authored-by:
Cursor Agent <cursoragent@cursor.com>
-
Tobias Koppers authored
## What? Added a new section "Task Decomposition and Verification" to AGENTS.md that provides guidance on breaking down work into smaller, verifiable tasks and establishing verification practices before moving to the next step. ## Why? This guidance helps ensure that AI agents (and developers) work systematically by: - Breaking complex goals into incremental, independently verifiable steps - Establishing clear verification checkpoints before proceeding - Choosing appropriate verification methods for different types of changes - Asking for clarification when verification approaches are unclear This promotes more reliable and traceable development practices. ## How? Added four bullet points under a new "Task Decomposition and Verification" section that outline: 1. How to split work into smaller, verifiable tasks upfront 2. The importance of verifying each task before moving forward 3. Guidance on selecting appropriate verification methods (tests, type checking, linting, builds, etc.) 4. When and how to ask users for clarification on verification approaches https://claude.ai/code/session_012eJNxH5NRUHKdAaNpz4Yr6Co-authored-by:
Claude <noreply@anthropic.com>
-
nextjs-bot authored
[diff facebook/react@95ffd6cd...2dd9b7cf](https://github.com/facebook/react/compare/95ffd6cd...2dd9b7cf) <details> <summary>React upstream changes</summary> - https://github.com/facebook/react/pull/35724 - https://github.com/facebook/react/pull/35711 - https://github.com/facebook/react/pull/35710 - https://github.com/facebook/react/pull/35708 - https://github.com/facebook/react/pull/35705 - https://github.com/facebook/react/pull/35700 </details>
-
Robert Webb authored
Note that this is my first contribution in Rust, so let me know if I missed anything idiomatic or if there is a particularly better way to do something. Also, I did not use AI to create this at all, although I did chat a bit to try to wrap my head around types. - Related issues linked using Fixes https://github.com/vercel/next.js/issues/88533 - Tests added. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md Summary of changes: Adds support for all of the attributes of `@import` for Turbopack, by modifying the turbopack-css package, including Layer, Media and Supports. [W3 Reference](https://www.w3.org/TR/css-cascade-5/#at-import) --------- Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Luke Sandberg authored
Remove the field and corresponding generic type parameter. These are unused as of #88492
-
Luke Sandberg authored
# Implement Inline Value Storage in SST Files This PR enhances the Static Sorted Table (SST) file format by implementing inline value storage for small values (≤8 bytes). Instead of storing these small values in separate value blocks, they are now stored directly in the key blocks, which: 1. Reduces indirection overhead (8 bytes per value) 2. Improves read performance by eliminating an extra lookup 3. Reduces the total size of SST files The implementation: - Adds a new `EntryValue::Inline` variant for values ≤8 bytes - for values <=8 bytes the 'small value' encoding is pure overhead (8 bytes to address <=8 bytes). This threshold was chosen to not regress key block sizes. * from an 'overall data perspective' inline is beneficial for basically all acceptable value sizes. However, it will very likely regress binary search performance to stuff maximally large values inline, so we don't do this for now. - Introduces key block entry types 8-255 to encode inline values (supporting up to 247 bytes) - Updates the README to document the inline value format - Enhances `ArcSlice` with a new `slice_from_subslice` method for zero-copy access to inline values - Adds a `Read` implementation for `ArcSlice<u8>` to support streaming reads -
Tobias Koppers authored
### What? When AMQF is not available performance will degrade significately. So we want to make sure that AMQF is always cached. This removes the AMQF cache, which tends to overflow with very large databases. ### read, get, key = 8, value = 4, commits = 1, compacted, hit, uncached | entries | | Baseline | | This PR | | Change | | -------- | ---- | --------- | ---- | --------- | ---- | ------------------ | | 10.67Mi | 1.0x | 20.55 µs | 1.0x | 20.55 µs | 1.0x | ~same | | 21.33Mi | 2.0x | 23.30 µs | 1.1x | 23.30 µs | 1.1x | ~same | | 42.67Mi | 4.0x | 37.18 µs | 1.8x | 37.18 µs | 1.8x | ~same | | 85.33Mi | 8.0x | 27.80 µs | 1.4x | 27.80 µs | 1.4x | ~same | | 128.00Mi | 12x | 33.07 µs | 1.6x | 86.24 µs | 4.2x | 2.4x - 2.8x slower | | 170.67Mi | 16x | 807.11 µs | 39x | 180.47 µs | 8.8x | 4.1x - 4.8x faster | | 341.33Mi | 32x | 992.15 µs | 48x | 283.60 µs | 14x | 3.2x - 3.8x faster | ### read, get, key = 8, value = 4, commits = 1, compacted, miss, uncached | entries | | Baseline | | This PR | | Change | | -------- | ---- | --------- | ---- | --------- | ---- | -------------------- | | 10.67Mi | 1.0x | 302.07 ns | 1.0x | 302.07 ns | 1.0x | ~same | | 21.33Mi | 2.0x | 465.93 ns | 1.5x | 465.93 ns | 1.5x | ~same | | 42.67Mi | 4.0x | 757.96 ns | 2.5x | 757.96 ns | 2.5x | ~same | | 85.33Mi | 8.0x | 1.47 µs | 4.9x | 1.47 µs | 4.9x | ~same | | 128.00Mi | 12x | 4.30 µs | 14x | 367.02 ns | 1.2x | 5.9x - 23.0x faster | | 170.67Mi | 16x | 21.89 µs | 72x | 731.82 ns | 2.4x | 19.4x - 43.3x faster | | 341.33Mi | 32x | 39.28 µs | 130x | 972.98 ns | 3.2x | 31.5x - 52.7x faster |
-
Tobias Koppers authored
### What? They are basically identical to the cached variants and therefore not needed
-
- 07 Feb, 2026 6 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
If an old version of the CLI is cached on a CI runner but still in the old range it can cause this test to fail. x-ref: [slack thread](https://vercel.slack.com/archives/C07UCHRBWGK/p1770501780921239?thread_ts=1770499294.893139&cid=C07UCHRBWGK)
-
Hendrik Liebau authored
Previously, unused argument omission was only applied to `"use cache"` functions called from the client (#72506). This enables it for server actions as well, and optimizes `omitUnusedArgs` to trim trailing unused arguments from the sparse array, so that nothing is sent to the server for those instead of `undefined`.
-
JJ Kasper authored
This is causing conflicts as the name value is relied on too much since it can differ heavily e.g. for `src` dir and if not. x-ref: https://github.com/vercel/next.js/actions/runs/21767409431/job/62826336354#step:34:240 Reverts vercel/next.js#89559
-
JJ Kasper authored
These are too specific as `charset` is valid to be included in the `content-type` as well so this loosens the assertion. x-ref: https://github.com/vercel/next.js/actions/runs/21767409431/job/62826336346#step:34:339 x-ref: https://github.com/vercel/next.js/actions/runs/21767409431/job/62826336379#step:34:294
-
JJ Kasper authored
This expands test suite for deferred entries experimental handling and fixes missing handling for metadata routes and route handlers when building the non-deferred entries.
-
- 06 Feb, 2026 15 commits
-
-
Maikel van Dort authored
### What? Fix deprecated warning: "Use Object.assign instead of deprecated util._extend" from http-proxy (which hasn't been updated for 5 years) ### Why? ### How? Fixes #74460 In favour of https://github.com/vercel/next.js/pull/81544 (which didn't use a patch, but manually updated the compiled version)
-
nextjs-bot authored
-
Niklas Mischkulnig authored
- checked_div - loop -> while
-
Niklas Mischkulnig authored
When proxying through multiple projects, this header would get overwritten by the proxy project: - the header would be the proxy's deployment id - `process.env.NEXT_DEPLOYMENT_ID` would be the origin's deployment id Needs https://github.com/vercel/vercel/pull/14903
-
Will Binns-Smith authored
This adds `--experimental-server-fast-refresh` CLI flag to enable experimental server-side Fast Refresh (HMR) during development. It's disabled by default. We call HMR "fast refresh" in public docs so let's keep the flag consistent with that. We use the HMR naming past this outer layer in the codebase. Test Plan: ```bash next dev --experimental-server-fast-refresh ```
-
Matt Mastracci authored
## What Changes how Turbopack creates Web Workers and Worker Threads to use a unified factory function pattern. Workers now receive the same runtime globals (like `NEXT_DEPLOYMENT_ID` and `NEXT_CLIENT_ASSET_SUFFIX`) as the parent context, and asset loading works correctly inside workers. ## Why Previously, worker creation was split between compile-time URL generation and runtime initialization, which made it difficult to: - Forward runtime globals to worker contexts - Ensure workers could load chunked assets with the correct suffix - Maintain consistent initialization logic across browser and Node.js workers This caused issues when workers needed to dynamically import assets or access deployment-specific configuration. ## How Worker loader modules now export a factory function that receives the Worker constructor and options, rather than just a URL. The runtime handles all worker initialization, including forwarding necessary globals. This keeps all worker creation logic in a single place (the runtime) rather than being split between Rust code generation and JavaScript execution. Tests added for PNG asset loading in workers to verify the asset suffix forwarding works correctly in both browser and Node.js contexts.
-
Hendrik Liebau authored
The error code plugin now resolves local variable references in error constructors to their string literal initializers. Previously, `const msg = 'Error text'; throw new Error(msg)` would produce `"%s"` as the error message, preventing it from being tracked in `errors.json`. A pre-pass `BindingCollector` now collects variable declarations before the transformation pass, enabling error code assignment for these patterns. This adds 50 new error codes to `errors.json`. Variable references that still can't be resolved include imported constants (cross-module), function return values, object property access, and function parameters. These continue to produce `"%s"` as before. Also fixes `rcstr!()` to `.into()`. The `rcstr!` macro was introduced by a bulk Turbopack refactor (#80552), but was never available as a dependency of this standalone crate. `turbo-rcstr` can't be added as a dependency because it uses workspace-level dependency references that aren't resolvable from this standalone crate's `Cargo.lock`.
-
JJ Kasper authored
This ensures we copy over the changes from https://github.com/vercel/vercel/pull/13816 so static metadata is not output as a prerender instead of a static output.
-
Ben Gubler authored
## Summary Route collection, mapping, and processing logic was duplicated across six call sites (`build/index.ts`, `build/analyze/index.ts`, `cli/next-typegen.ts`, `server/lib/router-utils/setup-dev-bundler.ts`, `server/mcp/tools/get-routes.ts`, and `build/entries.ts`). Each independently orchestrated the same sequence: collect files → create page mappings → process routes → extract slots. This PR extracts that logic into two focused modules: - **`build/route-discovery.ts`** — Exports a high-level `discoverRoutes()` function that handles the full collect → map → process pipeline in one call. Also re-exports the lower-level helpers (`createPagesMapping`, `collectAppFiles`, etc.) for call sites that need them. - **`build/file-classifier.ts`** — Shared types (`RouteInfo`, `SlotInfo`) and slot extraction utilities (`extractSlotFromPath`, `addSlotIfNew`, `combineSlots`) used by both the build and dev server. ## Bug fix Fixes a bug in the dev bundler (`setup-dev-bundler.ts`) where `hasRootAppNotFound` was set to `true` unconditionally for every app directory file, rather than only when an actual `not-found` file was encountered. This caused the server to incorrectly report the existence of a root not-found boundary for any project with an app directory. ## Performance - **Eliminates a duplicate directory traversal** — The old build code called `collectAppFiles()` twice: once during the main flow and again during route type generation to get `defaultPaths`. Now all three file categories (pages, layouts, defaults) are collected in a single `recursiveReadDir` call. - **Parallelizes app file mapping** — App pages, layouts, and default files are now mapped concurrently via `Promise.all` instead of sequentially. - **MCP tool parallelism** — The `get-routes` MCP tool now discovers app and pages routes in parallel instead of sequentially. ## Changes - `build/entries.ts` — Removed ~470 lines of collection/mapping/processing functions (moved to `route-discovery.ts` and `file-classifier.ts`). Retains entrypoint creation logic. - `build/index.ts` — Replaced inline orchestration with a single `discoverRoutes()` call. - `build/analyze/index.ts` — Replaced inline orchestration with `discoverRoutes()`. - `cli/next-typegen.ts` — Replaced ~60 lines of inline orchestration with `discoverRoutes()`. - `server/lib/router-utils/setup-dev-bundler.ts` — Replaced inline slot detection with `addSlotIfNew()`. Fixed `hasRootAppNotFound` bug. - `server/mcp/tools/get-routes.ts` — Replaced ~80 lines of manual collection with two parallel `discoverRoutes()` calls. - `server/lib/find-page-file.ts` — Deduplicated regex construction in `createValidFileMatcher` using helper factories. - `server/lib/router-utils/route-types-utils.ts` — Updated to use shared `RouteInfo`/`SlotInfo` types from `file-classifier.ts`.
-
JJ Kasper authored
- Add retry logic (3 attempts with 5s delay) for transient network failures - Don't fail the job when cache restoration fails - let workflow build from source - Add error handling for dry run failures and JSON parsing This attempts to address transient failures seen here https://github.com/vercel/next.js/actions/runs/21735816168/job/62700523424?pr=89574
-
Jiachi Liu authored
Filter out the extra logging from test env so we only assert on the snapshot of forwarded logs ``` Snapshot name: `Terminal Logging (Webpack) App Router - Hydration Errors should show hydration errors with owner stack trace 1` - Snapshot - 1 + Received + 9 @@ -39,7 +39,15 @@ 6 | <div> > 7 | <p>{isClient ? 'client' : 'server'}</p> | ^ 8 | </div> 9 | ) - 10 | } + 10 | } + + + [12:36:48.104Z] Browser Log: received ws message {"type":"isrManifest","data":{"/hydration-error":true}} + + [12:36:48.104Z] Browser Log: Next.js page already hydrated + + [12:36:48.109Z] Hydration complete for http://localhost:46145/hydration-error " at Object.toMatchInlineSnapshot (/root/actions-runner/_work/next.js/next.js/test/development/browser-logs/browser-logs.test.ts:317:33) at runNextTicks (node:internal/process/task_queues:60:5) at processImmediate (node:internal/timers:449:9) at process.callbackTrampoline (node:internal/async_hooks:130:17) ``` -
Sebastian "Sebbie" Silbermann authored
Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
bencmbrook <7354176+bencmbrook@users.noreply.github.com>
-
Niklas Mischkulnig authored
Closes PACK-6833 Testing - https://github.com/nextjs/adapter-vercel/pull/18 - https://github.com/nextjs/adapter-vercel/pull/17
-
Thomas Schrödinger authored
This pull request makes minor documentation improvements to the `robots.mdx` API reference, correcting a typo and clarifying the description of `robots.js` route handler behavior. - Documentation clarity and typo fixes: * Corrected "Route Handlers" to "Route Handler" in the description of `robots.js` and updated the explanation for clarity. * Fixed the spelling of "customise" to "customize" for consistency with American English.* Fixed spelling on some words of the robots.mdx documentation: - Handlers (plural) to Handler (singular) - customise = customize <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Tobias Koppers authored
### What? add benchmarks for database operations
-
- 05 Feb, 2026 10 commits
-
-
JJ Kasper authored
Makes sure we don't use both `_middleware` and `middleware` naming for the output. Found in https://github.com/vercel/next.js/pull/89522 we were using both.
-
nextjs-bot authored
-
Luke Sandberg authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
Niklas Mischkulnig authored
The next config setting was renamed, so this was always false. So far, this was only used for telemetry.
-
nextjs-bot authored
-
Pavan Shinde authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: For Contributors Improving Documentation • [x] Run pnpm prettier-fix to fix formatting issues before opening the PR. • [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide Fixing a bug • [ ] Related issues linked using fixes #number • [ ] Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs • [ ] Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md Adding a feature • [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) • [ ] Related issues/discussions are linked using fixes #number • [ ] e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) • [ ] Documentation added • [ ] Telemetry added. In case of a feature if it's used or not. • [ ] Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md For Maintainers • [ ] Minimal description (aim for explaining to someone not on the team to understand the PR) • [ ] When linking to a Slack thread, you might want to share details of the conclusion • [ ] Link both the Linear (Fixes NEXT-xxx) and the GitHub issues • [ ] Add review comments if necessary to explain to the reviewer the logic behind a change What? Fix a broken link in the ISR guide by switching to a site-absolute /docs/... URL for the res.revalidate reference. Why? Without the leading /, the link can resolve as a relative path and break depending on where it’s rendered. How? Update the ISR guide link target to a site-absolute /docs/pages/guides/incremental-static-regeneration#on-demand-validation-with-resrevalidate. Closes NEXT- Fixes # -->
-
Janka Uryga authored
This PR implements the initial version of dev-time validation for `export const instant = ...` ```tsx export const instant = { prefetch: 'static' } ``` ```tsx export const instant = { prefetch: 'runtime', ... } ``` ```tsx export const instant = false ``` (the config is currently expected to be named `unstable_instant`, but i'll be shortening it to `instant` below.) When a segment specifies an instant config with `prefetch: 'static'` or `prefetch: 'runtime'`, we'll validate that all (prefetched) navigations into that segment will render instant UI, i.e. that the navigation won't block. On the other hand, if a segment is allowed to block, it must be marked with `export const instant = false`. Note that our existing static shell validation is a special case of this, but for now, we're keeping both. A future PR will reimplement static shell validation as a special case of instant validation. Like static shell validation, these validations currently run in dev whenever we render the full page (i.e. no segments are omitted). This means it'll happen on an initial load (or refresh) and HMR. ### Implementation notes #### Validation approach The goal is to simulate what the browser would display for a prefetched client navigation. We do this by re-assembling the segments extracted from the original stream for the page. - The outer (shared) segments should already fully resolved (i.e. in the Dynamic stage), to represent the fact that the browser loaded them before - The new segments are either in Static or Runtime stage, depending on how each segment would have been prefetched. Similar to static shell validation, we then perform a Fizz prerender on the combined payload, abort it, and track the locations of `onError` calls. The difference here is that unlike static shell validation, we require a Suspense boundary *inside* the new subtree. This is detected by adding a `InstantValidationBoundary` around the new subtree when we construct the payload, and checking if there's a suspense below that in the component stack. Currently, for each `instant` config we find, we take each of its parent layouts as a possible navigation parent (unless it's marked as blocking). So if we have a page with parent layouts like this: ``` /layout.tsx /foo/layout.tsx /foo/bar/layout.tsx /foo/bar/page.tsx <- `export const instant = { prefetch: 'static' }` ``` Then we'll check for navigations where each of `/layout.tsx`, `/foo/layout.tsx` and `/foo/bar/layout.tsx` is a fully resolved shared parent. If a validation fails, we do a "discriminated error message" flow analogous to static shell validation. Static segments are replaced with Runtime segments to see if the error goes away, which lets us determine if the hole is caused by runtime or dynamic data. #### Building the combined payload First, we need to separate the full stream into segments. The process is similar to `collectSegmentData` -- we need to deserialize the payload from the stream and then re-serialize each segment separately. The complexity here comes from the fact that the full stream is separated into stages, and we need each segment to be in staged form as well. This lets us pick and choose which stage the segment is in to simulate what we'd show for a static or runtime prefetch. The other complex part is the "late release trick" (as implemented in `createNodeStreamWithLateRelease`). This was already done for static shell validation, but it's more complex here. Debug info for dynamic holes is usually delayed until a further stage. So, in the static stage we only see an unresolved promise (or lazy reference), and then in the runtime stage we get the debugInfo telling us that it was caused by `await cookies()`. To ensure that this debug info is available for purposes on error reporting, we do a "late release" -- before we abort, we advance the each segment to the dynamic stage, which won't cause any new content to render, but will provide Fizz with debug info and thus give us precise error locations in `onError`. If you see `releaseSignal`, that's what it's for. #### `instant` on layouts We support specifying `instant` on layouts. The validation principle is the same, but note that in the current mode (validating a single page in dev) we can't enforce that *all* navigations into that layout satisfy the constraint, we can only check if that's satisfied for the current page. #### Blocking segments A segment can be marked as blocking with ```tsx export const instant = false ``` This is meant to signal that this segment deliberately does not have instant UI. Currently, this is affects validation as follows: If there's no `instant` config in parent segments, skip validating all navigations where this layout would be new (because we know it'd block), i.e. only validate navigations where it's a shared parent. Children of this segment can still have `instant` configs of their own, and those will be validated. This allows structures where a layout is blocking, but once it's loaded, navigations within it should have instant UI. If there is an `instant` config in a parent segment, the validation of that parent is *not* skipped. The reasoning here is that if a layout asserts that navigations into it should have static UI, then a child with `instant = false` should not violate that. This essentially requires that the child have a `loading.js` or that the layout has to wrap the slot with Suspense. Note that `instant = false` can also be used to opt segements out of static shell validation without requiring a Suspense above body. ### Limitations and planned follow-ups - `instant` configs in parallel routes (i.e. `@slot`) are not currently validated. - `expectUnableToVerify` is not implemented yet, i.e. there's no way to say "this cannot be validated using SSR". The shared segments are not expected to suspend. For now, `export const instant = { prefetch: ..., unstable_disableValidation: true }` can be used to bypass a segment if validating it causes problems. - static shell validation is a special case of instant validation, but is not currently implemented as such. - we should be able to validate during client navigations, not just full-page loads and HMR, but we currently can't because we don't have all the segments when we do that, so we can't assemble a proper combined payload. -
Hendrik Liebau authored
This PR adds error handling for nested `"use cache"` where the inner cache has a very short lifetime (zero `revalidate` or `expire` under 5 minutes) but the outer cache doesn't have an explicit `cacheLife()` call. Short-lived caches become "dynamic holes" that are excluded from prerenders. When such a cache is nested inside another `"use cache"` without an explicit `cacheLife`, the outer cache's lifetime would silently become short too via [propagation](https://nextjs.org/docs/app/api-reference/functions/cacheLife#nested-caching-behavior), which can lead to unexpected behavior. To prevent this accidental misconfiguration, Next.js now throws an error during prerendering, requiring developers to explicitly declare their intent by adding `cacheLife()` to the outer cache. The implementation tracks whether `revalidate` and `expire` were explicitly set via `hasExplicitRevalidate` and `hasExplicitExpire` flags on the collected cache result. Errors are wrapped with `wrapAsInvalidDynamicUsageError` to capture proper stack traces and prevent userland try/catch from suppressing the build error. Documentation has been updated with a new "Prerendering behavior" section in the `cacheLife` API reference explaining how short-lived caches become dynamic holes, and a "Nested short-lived caches" subsection with examples showing how to fix the error. closes NAR-761
-
Niklas Mischkulnig authored
Using the Vercel builder to get an authoritative list of files that end up in the function.
-
Niklas Mischkulnig authored
Previously: ``` pnpm next build ▲ Next.js 16.2.0-canary.28 (Turbopack) Creating an optimized production build ... ✓ Compiled successfully in 5.7s Running TypeScript ... Failed to compile. ./app/page.tsx:3:5 Type error: Type 'string' is not assignable to type 'number'. 1 | import Nav from "../components/Nav"; 2 | > 3 | let x: number = 'abc' | ^ 4 | 5 | 6 | const IndexPage = () => ( Next.js build worker exited with code: 1 and signal: null ``` Now: ``` pnpm next build ▲ Next.js 16.2.0-canary.28 (Turbopack) Creating an optimized production build ... ✓ Compiled successfully in 5.7s Running TypeScript ... Failed to type check. ./app/page.tsx:3:5 Type error: Type 'string' is not assignable to type 'number'. 1 | import Nav from "../components/Nav"; 2 | > 3 | let x: number = 'abc' | ^ 4 | 5 | 6 | const IndexPage = () => ( Next.js build worker exited with code: 1 and signal: null ```
-