- 06 Feb, 2026 14 commits
-
-
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 13 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 ``` -
Niklas Mischkulnig authored
The build id comment in HTML documents was added in https://github.com/vercel/next.js/pull/81247 But it was removed again to detect redirects using a HEAD request instead in https://github.com/vercel/next.js/pull/85910 Meaning the build id comment is completely unused now, so no need to insert it see https://vercel.slack.com/archives/C04KC8A53T7/p1770196901369359 Closes PACK-6846
-
nextjs-bot authored
-
JJ Kasper authored
-
- 04 Feb, 2026 13 commits
-
-
nextjs-bot authored
-
Janka Uryga authored
Mostly mechanical rename. Also changes the error page to `errors/invalid-instant-configuration`. I'm not really worried about dangling links here because this is a new API and we don't expect anyone to be using it yet.
-
Andrew Clark authored
## Summary Adds `experimental.exposeTestingApiInProductionBuild` to make the Instant Navigation Testing API available in production builds. This is a stopgap until a dedicated "profiling build" mode exists—similar to React's profiling builds that include extra instrumentation without the dev-mode overhead. The testing API lets e2e tests assert on prefetched UI before dynamic data streams in. Previously it was dev-only, but production builds have different timing characteristics (prefetches complete faster, code paths differ), so testing against production builds is valuable. ## Approach Introduces a single bundler environment variable `process.env.__NEXT_EXPOSE_TESTING_API` that's true when either: - Running in dev mode, OR - The experimental flag is enabled This replaces scattered `NODE_ENV !== 'production'` checks throughout the testing API code paths, making the gating logic consistent and centralized in the build configuration. Also renames `dev-navigation-lock.ts` to `navigation-testing-lock.ts` and updates header/cookie names from "dev-only" to "instant-navigation-testing" to reflect that the API is no longer dev-exclusive. ## Test plan - Updated existing e2e tests to run in both dev and production modes - Tests pass with `NEXT_TEST_MODE=start` (production build)
-
Jiachi Liu authored
For forwarded logs, we can also attach the owner stack if it's available, then we can see the proper errors trace shown in the terminal. In this way agent can directly detect where the error is happening from reading terminal log, and fix it | After | Before | |:---|:---| | <img width="937" height="778" alt="image" src="https://github.com/user-attachments/assets/666cc012-4e79-41f4-9d6f-b9c1969316bf" /> | <img width="942" height="641" alt="image" src="https://github.com/user-attachments/assets/a44f795a-d297-4fb8-9efe-25e6e3684014" /> |
-
Niklas Mischkulnig authored
Reapply https://github.com/vercel/next.js/pull/88959 Revert https://github.com/vercel/next.js/pull/89323 Closes PACK-6537 Closes PACK-6756 - Deployment skew (forcing a MPA nav instead of a SPA nav if a deployment happened inbetween) is handled by comparing a header on the client side. - The other case that used build ids was app router, which was changed to the same approach in https://github.com/vercel/next.js/pull/88855 - Then, when a deployment id is available, make the build id a constant - Particularly, this makes the rollout of this much easier as the data route paths stay the same (both in Next.js itself as well as in the builder) If you use `output:export` and set `config.deploymentId` (i.e. enable skew protection) you are still expected to set these headers.
-
Eric Rabinowitz authored
Fixes syntax for the code sample found on https://nextjs.org/docs/pages/guides/multi-zones#routing-requests-using-proxy --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Jam Balaya authored
## Summary Remove the [with-tigris](https://github.com/vercel/next.js/tree/canary/examples/with-tigris) example and clean up its references in lint and test configs Build: - Remove with-tigris paths from .eslintignore - Remove with-tigris entry from turbopack-dev-examples-manifest.json Chores: - Delete the with-tigris example directory and all its files ## Why? [@tigrisdata/core](https://github.com/tigrisdata-archive/tigris-client-ts) package hasn't been maintained in 2 years. ## Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md cc: @samcx Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
Some better suggestions
-
Andrew Clark authored
Based on: - https://github.com/vercel/next.js/pull/89465 --- The `instant()` testing API allows e2e tests to assert on prefetched UI before dynamic data streams in. This extends it to handle full page navigations: page reloads, plain anchor clicks, and browser back/forward. For client-side navigations, the API uses request headers to trigger static shell rendering. For MPA navigations, headers aren't available, so this uses a cookie-based approach instead. When `instant()` acquires a lock, it sets a cookie that tells the server to render the static shell. When the lock is released, the cookie is cleared and the page reloads to fetch dynamic content. On pages loaded with the test cookie, hydration is skipped entirely and a minimal testing API is set up in the bootstrap script. This is similar to how the `__nextppronly` debug parameter works (an internal experiment that was never shipped). This feature is the productionized version of that approach, designed for actual use in e2e tests. New test cases: - Static shell on page reload - Static shell on plain anchor navigation - Multiple MPA navigations within a single `instant()` scope - Verifies navigations work normally after exiting `instant()` scope
-
Andrew Clark authored
## Summary Adds a dev-mode primitive for writing e2e tests that assert on the prefetched/cached portion of a navigation. The API blocks dynamic data from streaming in until assertions complete, allowing deterministic testing of loading states without race conditions. This gives developers a way to verify that specific UI elements render instantly from cache, rather than relying on network timing. It also reinforces the mental model that navigation performance should be thought of primarily in terms of cached vs. dynamic. This PR implements the primitive that Next.js exposes on the window object. In practice, it's meant to be used via a testing framework integration, like a Playwright helper: ```typescript await instant(page, async () => { await page.click('a[href="/products/123"]'); await expect(page.locator('[data-testid="skeleton"]')).toBeVisible(); }); ``` The implementation forces a prefetch before navigation when inside an `instant` scope (since prefetching is normally disabled in dev), then holds dynamic data until the scope ends. All code is wrapped in dev checks and gets dead code eliminated in production. Current scope is client-side navigations only. SSR/MPA support is planned as a follow-up. ## Test plan - `test/e2e/app-dir/instant-navigation-testing-api` -
Tim Neutkens authored
## What? Use signal-based exit codes when shutting down the Next.js server to prevent the process from waiting for the debugger to disconnect. ## Why? When Node.js devtools are attached (via `--inspect` flag or the Next.js DevTools "Attach debugger" feature), pressing Ctrl+C causes the dev server to hang instead of exiting immediately. This happens because calling `process.exit(0)` makes Node.js treat it as a normal exit, which waits for all debuggers to disconnect before terminating. In contrast, plain Node.js terminates immediately on SIGINT even with a debugger attached, because signal-based termination doesn't wait for debuggers. ## How? Instead of calling `process.exit(0)` after cleanup, use signal-based exit codes: - SIGINT (signal 2) → `process.exit(130)` (128 + 2) - SIGTERM (signal 15) → `process.exit(143)` (128 + 15) This tells Node.js the process was terminated by a signal, which avoids the debugger wait behavior. Changes: - Modified the cleanup function to accept the signal that triggered it - Use `process.exit(signal === 'SIGINT' ? 130 : 143)` instead of `process.exit(0)` - Removed the previous `inspector.close()` workaround as it's no longer needed --------- Co-authored-by:Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
-
Niklas Mischkulnig authored
Part of PACK-6641 We don't have a way to silence (ignore-comment) warnings And additionally, warnings in node_modules are always hidden...
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-