1. 22 Jul, 2026 3 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-preview.8 · bedbdcfe
      next-js-bot[bot] authored
      bedbdcfe
    • Sebastian "Sebbie" Silbermann's avatar
      Always consult `npm_config_user_agent` first (#95879) · 1353c788
      Sebastian "Sebbie" Silbermann authored
      The `getPkgManager` helpers previously consulted the filesystem first
      for files hinting at the used package manager. Only if none were found
      did we check `process.env.npm_config_user_agent` and then shelled out to
      testing which package manager is available.
      
      This change makes all helpers check the `npm_config_user_agent`
      environment variable first. The variable is set by the package manager
      that invoked the process, so when present it is both the cheapest and
      the most direct signal, avoiding filesystem access and subprocess spawns
      entirely. `create-next-app` already used this user-agent-first approach
      and is unchanged.
      
      The check order is now consistent across all three implementations:
      yarn, pnpm, bun, npm for the user agent (the `packages/next` variant has
      no `bun` in its `PackageManager` type and falls through to lockfile
      detection there), and the same order for the codemod's lockfile walk,
      which previously prioritized `package-lock.json`.
      
      Because the invoking package manager now takes precedence over lockfile
      inference, running `npx next ...` or `npx @next/codemod ...` inside a
      pnpm or yarn app is now detected as npm. Use `pnpx` (or `pnpm dlx`) and
      `yarn dlx` instead so the detected package manager matches the project.
      1353c788
    • Jude Gao's avatar
      Rewrite next-cache-components-optimizer around a test-driven instant() loop (#94721) · 1d3bf10c
      Jude Gao authored
      Rewrites `skills/next-cache-components-optimizer` in place: an agentic
      loop that encodes the goal as a failing `@next/playwright` `instant()`
      e2e, works it to green one route at a time, and ships the test as the
      regression guard. Covers initial load (hard navigation) and client-side
      navigation (soft navigation) with a test variant each, a VERIFY-RED gate
      against tests that fail for the wrong reason, and a setup phase that
      records the project's build/deploy/test infrastructure in a
      project-local `instant-nav.rig.md`, so the skill assumes no platform.
      
      Keeps the existing skill name, so the path from adoption to optimizer
      stays one story and there is nothing new to announce. The previous
      dev-loop workflow is replaced wholesale. A PREREQS gate requires Next.js
      16+ with `cacheComponents` and a matching `@next/playwright`, and
      directs an upgrade first when unmet.
      
      Generalized from a burn-down in the v0 codebase, where this loop ran
      agent-driven against CI previews; app-specific examples are scrubbed.
      Related: #94152 adds `instant-navs`; happy to converge the two.
      
      
      Also updates the one paragraph in
      `docs/01-app/02-guides/instant-navigation.mdx` that describes this skill
      to match the new loop.
      
      ---------
      Co-authored-by: 's avatarAurora Scharff <66901228+aurorascharff@users.noreply.github.com>
      Co-authored-by: 's avatarAurora Scharff <aurora.sofie@gmail.com>
      1d3bf10c
  2. 21 Jul, 2026 37 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.93 · c77f3ded
      next-js-bot[bot] authored
      c77f3ded
    • Joseph's avatar
      docs: attribute App Shell prefetch to Partial Prefetching (#96003) · 8be6c267
      Joseph authored
      `App Shells` are enabled with partial prefetching is enabled.
      8be6c267
    • Benjamin Woodruff's avatar
      Turbopack: Remove chunk group id from value of chunk groups map (#95142) · e1c8cc72
      Benjamin Woodruff authored
      It looks like we were redundantly storing these group ids in the
      `FxIndexMap`, when we could just use it's entry position.
      e1c8cc72
    • Benjamin Woodruff's avatar
      [ci] Enforce minimumReleaseAge in e2e tests that install external dependencies (#95628) · e630d818
      Benjamin Woodruff authored
      We also mitigate the security impact of e2e tests by running everything
      in VMs, and by not reading caches in release jobs, but we should still
      be using `minimumReleaseAge` in e2e tests.
      
      Ideally we'd also use lockfiles here too, and I'll work on that next,
      but that is likely a lot more complicated because we probably need some
      way to merge lockfiles, since we can't pin the next.js and react
      versions in every test, and we need a reasonable/efficient way to
      bulk-update all the lockfiles for tests that need it.
      
      Depends on https://github.com/vercel/next.js/pull/95668 for a bunch of
      windows path representation fixes that this ends up exposing in CI,
      because adding workspace files causes pnpm to change the absolute path
      representation used in the Windows junction points that it creates.
      e630d818
    • Benjamin Woodruff's avatar
      Turbopack: Fix missing canonicalization of paths and always use verbatim paths… · 3214020b
      Benjamin Woodruff authored
      Turbopack: Fix missing canonicalization of paths and always use verbatim paths internally for Windows (#95668)
      
      I was seeing failures on https://github.com/vercel/next.js/pull/95628
      and went down this rabbit hole.
      
      - We were (incorrectly) not canonicalizing the `DiskFileSystem` root
      dir. This happened to work out for us because pnpm also wasn't
      canonicalizing junction point targets, and so the root dir prefix
      matched. However after `#95628`, pnpm started canonicalizing junction
      point targets because we added `pnpm-workspace.yaml` files. This was
      just coincidence and indicative of much deeper problems.
      
      - `dunce` isn't a good fit for us. It picks a win32 or verbatim
      representation based on path length, which would mean that long paths
      inside of a short root path would never work because we'd never be able
      to strip the prefix, since we'd be looking for a win32 path prefix.
      Omnipath is better for what we want to do:
      https://docs.rs/omnipath/latest/omnipath/windows/trait.WinPathExt.html
      
      - The windows verbatim path format works with long paths (>260
      characters) and behaves a lot closer to cross-platform unix paths, which
      is what we want. E.g. if somebody tries to import a JS module from a
      Windows 8.3 short path, it should fail. This will fail with verbatim
      paths (good!). This PR *always* uses the verbatim path format internally
      within `DiskFileSystem`.
      
      - `read_link` was re-inventing `try_from_sys_path` but badly. Just call
      `try_from_sys_path`.
      
      - `turbopack/crates/turbo-tasks-fs/src/embed/file.rs` was dead code.
      
      - `validate_path_length_inner` was incorrectly referring to verbatim
      paths as UNC paths. These are two different things.
      
      - Canonicalize any absolute symlink targets outside of the
      `DiskFileSystem` root path, resolving any symlinks they may have,
      normalizing case-insensitive paths, and handling Windows 8.3 short name
      format.
      
      ## Some Context About Windows Path Formats:
      
      - win32 paths: These are your normal user-friendly `C:\foo\blah` paths.
      When calling most filesystem APIs, these are limited to 260 characters
      unless the user has enabled long paths on the system, and avoiding the
      limit with these paths also requires a [`longPathAware` application
      manifest](https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#longPathAware).
      You can mix `/` and `\` in win32 paths, and Windows will normalize the
      path separator for you.
      
      - verbatim paths: This is a rust-specific name (used by the stdlib) for
      the "extended length" prefixed paths. These are paths starting with
      `\\?\`. These paths can be up to ~32,767 characters long. They do not
      support Windows 8.3 shortnames. They do not normalize between `/` and
      `\`, and do not support `.` or `..` components, however
      [`Path::join`](https://doc.rust-lang.org/std/path/struct.Path.html#method.join)
      will do this normalization if given a verbatim path.
      
      - Windows 8.3 shortnames: A legacy format where paths can be represented
      by 8 characters, followed by a tilde and a digit (or hash in some
      extreme cases where there are many collisions), followed by a 3
      character file extension. NTFS supports this,
      [ReFS](https://learn.microsoft.com/en-us/windows-server/storage/refs/refs-overview)
      (used by [Windows Dev
      Drive](https://learn.microsoft.com/en-us/windows/dev-drive/)) does not.
      
      - UNC ("Universal Naming Convention"): This is a specific representation
      of paths used for remote files on network servers.
      
      - `file://` URIs: These must be formed from [win32 style
      paths](https://docs.rs/url/latest/url/struct.Url.html#method.from_file_path),
      though the normal 260 character limit typically does not apply here.
      
      - canonicalize: Corresponds to
      [`std::fs::canonicalize`](https://doc.rust-lang.org/stable/std/fs/fn.canonicalize.html).
      This involves actual fs operations (that we can't easily track), and
      recursively resolves symlinks. It will fail if the file path does not
      exist. On windows, this always returns a verbatim path.
      
      - wide format: Windows paths are utf-16. Generally we don't support
      paths that can't be encoded to utf-8, but we should try to fail as
      obviously as we can in these cases. We don't have good filesystem issue
      handling yet though.
      
      - case sensitivity: Generally paths are not case-sensitive on Windows or
      macOS, but are case-sensitive on most Linux filesystems. The exact
      definition of how case sensitivity works with unicode paths is highly
      platform and filesystem dependent.
      
      - junction points: The windows equivalent of symlinks (symlinks are also
      supported, but require developer mode to be turned on). These can
      contain an arbitrary path reference in any format (win32, verbatim, etc)
      with any case and with windows 8.3 short names. Junction points are
      always target absolute paths to directories.
      3214020b
    • Sam Poder's avatar
      Revert "[turbopack] Don't SSR on pages only navigated to through a soft nav (#95539)" (#96028) · 3ed60553
      Sam Poder authored
      Causes issues with `use client` it seems.
      3ed60553
    • Benjamin Woodruff's avatar
      Turbopack: Use `Arc<PathBuf>` for keys in turbo-task-fs's per-path `MutexMap` (#95951) · 2a3f8e0c
      Benjamin Woodruff authored
      We clone these `PathBuf`s a bunch of times, so use `Arc`s
      2a3f8e0c
    • Steven's avatar
    • Sam Poder's avatar
      [turbopack] Tree-shake CJS exports that use the `Object.defineProperty` syntax (#95994) · 18123b37
      Sam Poder authored
      This is a common format for transpilers to produce CJS code from ESM,
      eg. this output:
      
      ```javascript
      "use strict";
      Object.defineProperty(exports, "__esModule", { value: true });
      var x = { color: 'red' };
      ```
      
      from
      https://www.typescript-training.com/course/intermediate-v2/05-modules/.
      
      This PR extends the work done in
      https://github.com/vercel/next.js/pull/95716 to support this syntax.
      18123b37
    • next-js-bot[bot]'s avatar
    • next-js-bot[bot]'s avatar
      v16.3.0-preview.7 · d4b0dc31
      next-js-bot[bot] authored
      d4b0dc31
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.92 · 80fd3fed
      next-js-bot[bot] authored
      80fd3fed
    • Vercel Release Bot's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Zafor Abdullah's avatar
      fix: error handling and loading states in with-apollo-and-redux example (#91457) · 93c59f02
      Zafor Abdullah authored
      ## For Contributors
      
      ### Fixing a bug
      
      - Fixes #(open or reference an issue if one exists, otherwise omit)
      - No tests required — this is an `examples/` change only
      - No custom error links needed — failures are surfaced via Apollo's
      built-in error state
      
      ---
      
      ## Summary
      
      - `PostList` destructured `data` before checking `loading`/`error`, so
      the component threw when `data` was `undefined` (e.g., on the initial
      fetch or after a query error) instead of showing the loading/error UI.
      - Move the `error`/`loading`/`!data` guard clauses above the `data`
      destructuring and `loadMorePosts` definition, and add a `!data` check so
      the component never accesses properties on an undefined value.
      - Bump `graphql` (`14.5.8` → `16.13.1`) and `lodash` (`4.17.20` →
      `4.17.23`) in the example's `package.json` to pick up fixes in
      dependencies the example relies on.
      
      ## Note: 
      Initially this PR suppose to target upstream DB issue
      93c59f02
    • Jude Gao's avatar
      Preserve basePath in redirect destinations (#95608) · d6f2ca80
      Jude Gao authored
      Fixes an edge case ([repro](https://github.com/amannn/nextjs-16-3-bug-repro-basepath)) for `experimental.validateRSCRequestHeaders`.
      d6f2ca80
    • Sebastian "Sebbie" Silbermann's avatar
      [ci] Skip passed-tests cache steps for jobs that never run tests (#96001) · e8866c8b
      Sebastian "Sebbie" Silbermann authored
      CI jobs in `build_and_test` printed a "Cache save failed." warning from
      the "Save passed-tests cache" step even when they never run tests. The
      step ran for every job with an `afterBuild` command, but
      `.next-test-passed.txt` is only ever written by `run-tests.js`, so jobs
      like lint, rust-check, or types-and-precompiled warned on every run
      because the path never existed.
      
      `run-tests.js` already owns the decision of whether result caching is
      active (`profile.cachingEnabled`), so it now signals the workflow
      itself: when it opens the passed-tests file (which happens before any
      test runs, and only when result caching is enabled), it writes the path
      to the `passed_tests_file` step output. The "Save passed-tests cache"
      step in `build_reusable.yml` only runs when that output is present and
      takes its `path` from it. Jobs that never run `run-tests.js`, and
      flake-detection runs (where `NEXT_FLAKE_DETECTION` disables the result
      cache), never emit the output and skip the save silently. A job that
      fails midway through its tests has already emitted the output, so its
      partial file still saves and a genuine warning is still possible.
      e8866c8b
    • Aurora Scharff's avatar
      docs: add upgrade section to installation and expand AI agents guide (#95861) · 044ef6dc
      Aurora Scharff authored
      DOC-6499, two changes:
      
      **Installation: new "Upgrade your Next.js app" section.** The `next
      upgrade` command, why frequent updates matter (security patches, fixes,
      optimizations, new features), and that upgrading also updates the docs
      bundled in the `next` package, with a prompt for agents to catch up
      after an upgrade. Links the Upgrading page for version guides.
      
      **AI agents guide expanded.** Beyond bundled docs: runtime visibility
      (browser logs forwarded to the terminal, structured error copy, the MCP
      server for querying dev-server state) and skills for multi-step
      workflows. Covers the 16.2 case where docs are bundled but `AGENTS.md`
      is not auto-generated, and cross-links Upgrading.
      
      Claims verified against source (`next-upgrade.ts`, `agentRules`,
      `browserDebugInfoInTerminal`, `--no-agents-md`). Docs-only.
      044ef6dc
    • Joseph's avatar
      docs: fix unstable_cache syntax error (#96002) · f54dbb9c
      Joseph authored
      The function signature was wrong:
      
      ```tsx
      function Page({ params } }){
      ```
      
      Which also prevented prettier from running in the code block. This PR
      fixes the signature and formats the code block.
      f54dbb9c
    • Aurora Scharff's avatar
      Insights: use a single Learn more link in console errors (#95967) · 18d2e2da
      Aurora Scharff authored
      ## Summary
      
      The instant / blocking-prerender insight console errors printed a docs
      URL under each fix option (two or three anchors per message). This
      collapses them to a single `Learn more:` link at the end of each
      message, while keeping the `[stream]`/`[cache]`/`[block]` fix-option
      labels. It restores the single-link format these builders originally
      shipped with.
      
      **Before:**
      
      ```
      Ways to fix this:
        - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
          https://nextjs.org/docs/messages/blocking-prerender-runtime#wrap-in-or-move-into-suspense
        - [block] Set `export const instant = false` to allow a blocking route
          https://nextjs.org/docs/messages/blocking-prerender-runtime#allow-blocking-route
      ```
      
      **After:**
      
      ```
      Ways to fix this:
        - [stream] Provide a placeholder with `<Suspense fallback={...}>` around the data access
        - [block] Set `export const instant = false` to allow a blocking route
      
      Learn more: https://nextjs.org/docs/messages/blocking-prerender-runtime
      ```
      
      Covers all 16 insight-kind errors, across `blocking-route-messages.ts`,
      `sync-io-messages.ts`, `dynamic-rendering-utils.ts`, and
      `instant-messages.ts`.
      
      Because the dev overlay classified these errors by the `#`-anchored docs
      URL, `getBlockingRouteErrorDetails` is updated to match the anchor-less
      `Learn more:` URL. Console-message snapshots and the guidance-data
      extraction test are updated to the new format. The dev-overlay fix-card
      data (`instant-guidance-data.ts`) keeps its per-card links, since those
      are the overlay UI rather than the console message.
      
      ## Verification
      
      - `pnpm --filter=next types`
      - Snapshots regenerated with `jest -u` for the affected suites
      
      <!-- NEXT_JS_LLM -->
      18d2e2da
    • Tim Neutkens's avatar
      Refine development validation signal handling (#95998) · 380f0946
      Tim Neutkens authored
      ## Summary
      
      This follow-up addresses the remaining review comments from #95939.
      
      Pass the complete development validation generation through the
      background-validation lifecycle so cleanup invokes its finish method on
      the owning object.
      
      Make validation signals required throughout the development-only call
      chain and remove redundant optional checks, while preserving optional
      signals in helpers shared with build-time validation.
      
      ## Verification
      
      - pnpm exec jest --runTestsByPath
      packages/next/src/server/app-render/dev-validation-scheduler.test.ts
      packages/next/src/server/app-render/wait-for-response.test.ts
      - NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-turbo
      test/development/app-dir/instant-validation-scheduling/instant-validation-scheduling.test.ts
      - NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-webpack
      test/development/app-dir/instant-validation-scheduling/instant-validation-scheduling.test.ts
      
      <!-- NEXT_JS_LLM -->
      380f0946
    • WildCharger's avatar
      Include examples of static export tools & GitHub Pages template (#95929) · 3b7946d0
      WildCharger authored
      **What**: Included the examples of static export tools seen in the
      [Getting Started guide on deploying with static
      exports](https://nextjs.org/docs/app/getting-started/deploying#static-export).
      Added a reference to the official Next.js GitHub Pages template.
      **Why**: Per discussion #95756, the GitHub Pages template provided by
      Next.js can be somewhat easily missed. Its addition to a second location
      can alleviate this issue.
      **How**: A part of the language used in the Static Exports section of
      the Getting Started article was already present in the Static Exports
      guide. Therefore, the least obtrusive way to add the reference to the
      GitHub Pages template was to include it in said language.
      
      <!-- 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
      
      We encourage you to use AI to assist you in researching, creating, and
      reviewing changes. However, you must review and deeply understand the
      contributions you are making. For this reason, **pull request
      descriptions from external contributors must be written by a human**.
      
      ### 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
      
      ### Signed commits
      
      - This repository requires verified commit signatures on protected
      branches.
      - If this pull request is blocked for unsigned commits, re-sign the
      commits and force-push the branch.
      - A `Signed-off-by` line in the commit message is not enough.
      
      ## 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: 's avatarJoseph <sephxd1234@gmail.com>
      3b7946d0
    • Aurora Scharff's avatar
      docs: note the `:has()` scaling limit in the Interactive apps guide (#95925) · b4dabaff
      Aurora Scharff authored
      ### What?
      
      Adds a "Good to know" to the Interactive apps guide explaining that the
      `data-pending` + `group-has-data-pending:`/`has-data-pending:` pattern
      compiles to the CSS `:has()` selector, and when to reach for client
      state instead.
      
      ### Why?
      
      `:has()` is re-evaluated over the anchored subtree whenever the
      attribute toggles, so a broad anchor (like the whole board) combined
      with a high-frequency interaction can add up. The guide taught the
      pattern without noting that scaling limit, so a reader could copy the
      board-wide dim into a per-frame interaction and hit style-recalc cost.
      
      ### How?
      
      Documentation only. One callout in Step 3, calibrated so the guide's own
      board usage stays fine (it toggles only per filter, and dragging
      deliberately skips it), and pointing to client state for the
      high-frequency case.
      b4dabaff
    • Sebastian "Sebbie" Silbermann's avatar
      Prevent unhandled rejections when a "use cache" cache handler errors (#95985) · 8e7eb040
      Sebastian "Sebbie" Silbermann authored
      When a custom `"use cache"` cache handler's `get` method throws, the
      error was logged up to four times for a single request: once as the
      intended rendering error (`⨯ Error: ... { digest }`), and up to three
      more times through the various `unhandledRejection` handlers (the
      runtime's plain `console.error` in `process-error-handlers.ts`, the
      router server's `Log.error`, and the dev overlay's log forwarding).
      
      All the redundant logs stemmed from the same root cause:
      `ResolvableSharedCacheResult` stores its deferred promise in the dedup
      maps (`pendingCacheInvocations` / `crossRequestPendingCacheInvocations`)
      so concurrent invocations can join the leader. That promise has no
      consumer unless another invocation actually joins it, so when the
      leader's cache access failed, the rejected promise was left behind
      without a rejection handler, and Node.js reported it as an unhandled
      rejection that fanned out to every installed handler.
      8e7eb040
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Add coverage for throwing custom "use cache" cache handler (#95984) · ce207309
      Sebastian "Sebbie" Silbermann authored
      This is relevant if the cache is in a broken state or the keys or
      entries are not suitable (e.g. an entry that's to large to be stored).
      
      Revealed several oddities:
      1. cache handler have no no sources content (not too bad since that
      means the codeframe points into the problem `use cache` function which
      is usually the cause)
      2. A throwing `set` is swallowed in dev
      3. A throwing `get` is logged as a caught error and an unhandled
      rejection. This is spammy.
      ce207309
    • Ankur Prajapati's avatar
      docs: clarify layout.js nesting behavior in route groups (#95720) · 13dad0dd
      Ankur Prajapati authored
      ### What?
      
      - Adds one clarifying sentence (plus a link) to the "Organize routes
      without affecting the URL path" section in
      docs/01-app/01-getting-started/02-project-structure.mdx. No behavior
      change, docs text only.
      ---
      ### Why?
      
      - The existing sentence says you can add a layout.js inside a route
      group folder to give it a different layout, but it doesn't say whether
      that layout.js nests inside the top-level app/layout.js or replaces it.
      Read in order, a reader hits this line before the page ever mentions
      removing the top-level layout, so it's genuinely ambiguous at that point
      in the page. The nesting behavior is only clarified later, in the
      "Creating multiple root layouts" section — and even then, it's explained
      for a different, more specific case (removing the top-level layout
      entirely to give each route group its own root layout).
      ---
      ### How?
      
      - Added one sentence stating that this layout.js nests inside the
      top-level app/layout.js like any other layout by default, and linked to
      "Creating multiple root layouts" for readers who want the root-layout
      behavior instead.
      
      ---------
      Co-authored-by: 's avatarJoseph <sephxd1234@gmail.com>
      13dad0dd
    • Tim Neutkens's avatar
      Fix instant validation blocking navigations (#95939) · 81d0e851
      Tim Neutkens authored
      ### What?
      
      - Run development instant validation only after the navigation response
      has finished.
      - Let a newer request supersede stale validation work and yield between
      validation render attempts.
      - Forward the cancellation signal into React validation prerenders so
      asynchronous validation work can stop promptly.
      - Add focused scheduler/response tests and assert that development
      validation starts after the response finishes.
      
      ### Why?
      
      Instant validation was detached from the response promise, but its
      additional React renders still ran on the same Node.js event loop. A
      subsequent navigation could therefore wait hundreds of milliseconds for
      stale diagnostic work from the previous request.
      
      Instant validation still runs when the server is idle. When another
      navigation arrives, foreground request work now takes priority and the
      obsolete validation is discarded.
      
      ### How?
      
      Each Cache Components development request receives a validation
      generation signal. Starting a newer request aborts the previous
      generation. Validation waits for the Node response `finish` event,
      yields through the event-loop poll phase between attempts, and combines
      the generation signal with React's existing prerender abort signals.
      
      Tests:
      
      - `pnpm --filter=next build`
      - `pnpm --filter=next types`
      - `pnpm exec jest --runTestsByPath
      packages/next/src/server/app-render/dev-validation-scheduler.test.ts
      packages/next/src/server/app-render/wait-for-response.test.ts`
      - `NEXT_SKIP_ISOLATE=1 NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-turbo
      test/e2e/app-dir/instant-validation/suspense-boundaries.test.ts -t
      "valid - static prefetch - suspense around runtime and dynamic"`
      
      <!-- NEXT_JS_LLM_PR -->
      81d0e851
    • Benjamin Woodruff's avatar
      [ci] Share a single browser instance across all test suites in a single job (#95589) · 390eff3b
      Benjamin Woodruff authored
      The idea here is that we waste a bunch of CPU setting up each test suite
      by spawning an entirely new Chrome process, but playwright can share the
      same browser across many tests. Tests are still isolated at the browser
      level, just not at the OS process level.
      
      Hoping to see some performance improvement in e2e tests. Compare to:
      https://github.com/vercel/next.js/pull/95617
      
      Somewhat unscientific (single sample) results:
      
      ```
      Comparing the head-commit build-and-test runs — PR #95589 run [28981702219 ](https://github.com/vercel/next.js/actions/runs/28981702219)vs PR #95617 run [28981686692](https://github.com/vercel/next.js/actions/runs/28981686692). Both ran 101 jobs and both succeeded.
      
        ┌─────────────────────────┬────────────────┬───────────────────────┬───────────────────┐
        │         Metric          │ #95617 control │ #95589 shared browser │       Delta       │
        ├─────────────────────────┼────────────────┼───────────────────────┼───────────────────┤
        │ Raw wall-time sum       │ 616.2 min      │ 571.2 min             │ −45.0 min (−7.3%) │
        ├─────────────────────────┼────────────────┼───────────────────────┼───────────────────┤
        │ Billable (ceil per job) │ 658 min        │ 617 min               │ −41 min (−6.2%)   │
        └─────────────────────────┴────────────────┴───────────────────────┴───────────────────┘
      
        The shared-browser experiment is cheaper, and the savings land almost exactly where you'd expect — the browser-driven test suites — while non-browser jobs (rust, lint, unit, windows) are flat within noise:
      
        ┌─────────────────────────────────┬─────────┬────────┬───────┐
        │          Job category           │ control │ shared │ delta │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ test prod                       │   130.7 │  110.5 │ −20.2 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ cache components dev            │    51.5 │   42.9 │  −8.7 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ turbopack dev                   │    75.1 │   69.5 │  −5.5 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ turbopack production            │    86.3 │   81.1 │  −5.2 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ test dev                        │   110.4 │  105.5 │  −4.9 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ cache components prod           │    48.7 │   49.0 │  +0.3 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ firefox and safari              │     5.3 │    7.3 │  +2.0 │
        ├─────────────────────────────────┼─────────┼────────┼───────┤
        │ flake-detection jobs (combined) │     ~15 │    ~21 │   +~6 │
        └─────────────────────────────────┴─────────┴────────┴───────┘
      
        Takeaways:
        - Net savings of ~41 billable minutes per run (~6%), concentrated in the Chromium-driven test prod/dev, turbopack, and cache components suites — consistent with reusing one browser process instead of spawning per-suite.
        - The small regressions are in firefox and safari and the "new/changed tests for flakes" jobs (+~8 min combined). Worth a glance, though they may just be run-to-run variance.
      
        Caveat: this is a single run per PR, so there's real variance run-to-run. That said, the fact that the deltas track the browser-heavy jobs specifically — and not the Rust/lint/unit jobs — is a good signal the effect is genuine rather than noise. If you want a firmer number, re-running each PR 2–3× and averaging would tighten it up.
      ```
      390eff3b
    • Sam Poder's avatar
      [turbopack] Rename `turbopackTreeShaking` to `turbopackModuleFragments` (#95978) · e90189b9
      Sam Poder authored
      This has been causing a lot of confusion when contributors have been
      debugging tree shaking, eg.
      https://github.com/vercel/next.js/issues/95698 and the linked issues.
      Turbopack's standard tree-shaking features are controlled through the
      `turbopackRemoveUnusedExports` and `turbopackRemoveUnusedImports`
      options which default to true.
      e90189b9