- 21 Jul, 2026 28 commits
-
-
next-js-bot[bot] authored
-
next-js-bot[bot] authored
-
Vercel Release Bot authored
Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
https://github.com/vercel/next.js/security/advisories/GHSA-4c39-4ccg-62r3Co-authored-by:
Dmitrii Troitskii <jsleitor@gmail.com> Co-authored-by:
Sushanth Tiruvaipati <puzzleverseai@gmail.com>
-
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
-
Jude Gao authored
Fixes an edge case ([repro](https://github.com/amannn/nextjs-16-3-bug-repro-basepath)) for `experimental.validateRSCRequestHeaders`.
-
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.
-
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.
-
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. -
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 --> -
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 -->
-
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:
Joseph <sephxd1234@gmail.com>
-
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.
-
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. -
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.
-
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:Joseph <sephxd1234@gmail.com>
-
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 -->
-
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. ```
-
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.
-
Joseph authored
Update create-next-app templates to use `LayoutProps`
-
- 20 Jul, 2026 10 commits
-
-
next-js-bot[bot] authored
-
Marcos Hernanz authored
## Summary - skip the redundant aggregation-root update when `ConnectChildOperation` reconnects an already constructed top-level task that is already an aggregation root - avoid entering the aggregation operation loop when no update was queued The fast path is intentionally narrow. It applies only when the connection has no parent, the task has materialized output, and the task's aggregation number is already the root sentinel. The task may still be dirty and need to run; this only skips an idempotent aggregation update. A task that is not yet a root still goes through the normal update on its first top-level connection. Tasks without output are still scheduled, parented connections retain their activeness and aggregation updates, and transient-state boundaries are unchanged. ## Findings The earlier scheduler experiment has been removed completely. The apparent benefit from keeping a worker alive with `std::thread::yield_now()` was specific to the benchmark topology: Criterion's `Runtime::block_on` caller runs outside the single-worker Tokio runtime, so that external caller can enqueue the next root task while the runtime worker is yielding at the OS level. The sole Tokio worker itself cannot produce work during that loop. In normal scheduling, tasks typically enqueue their children before the current job exits, and a multi-worker runtime can start another worker when it is below its target. That does not justify burning CPU in an idle worker, nor replacing the loop with an async-yield retry loop. The retained optimization is independent of that artifact. An already constructed top-level task that is already rooted has no new root update to perform; re-enqueuing the idempotent update only forces the operation executor through unnecessary suspend points. This PR now contains no changes to `priority_runner`, worker lifetime, busy waiting, OS-thread yielding, async yielding, HMR, filesystem watching, or documentation. ## Benchmark results The benchmark source, runtime construction, profiles, allocator, toolchain, and worker count were unchanged. Frozen baseline and candidate executables were run adjacently in alternating order. Three focused pairs met the control-drift threshold; one pair was excluded before analysis because its Tokio control moved by more than 2%. Median candidate changes across the valid pairs: | Case | Change | | --- | ---: | | direct control | +0.071% | | Tokio control | -0.177% | | uncached task | +1.266% | | cached, same key | -37.868% | | cached, different keys | -26.783% | The complete all-duration local sweeps did not meet the control thresholds, so their task measurements are deliberately not cited. Fresh remote CodeSpeed and Stats results are the authoritative guardrail for the full benchmark. ## Verification - `cargo fmt --all -- --check` - `cargo clippy -p turbo-tasks-backend --all-targets -- -D warnings -A deprecated` - `cargo test -p turbo-tasks-backend` - `pnpm build-all` - two-engine autoreview after the final changes, with no findings - Not run: `pnpm --filter=next dev` (the final diff is Rust-only and was covered by the full bootstrap build and Cargo suites)
-
Sam Poder authored
This PR introduces two new things: a pass of the analyzer that recognises exports from CJS modules (in the form of `exports.foo`, see `analyze_cjs_exports`) and then a CodeGen that reads `export_usage_info` to remove CJS exports that are not used. This PR does not add anything additionally to `export_usage_info`, so this means that we only trim from modules that are imported with `import { foo } from "bar"`. The CodeGen depends on the output of `analyze_cjs_exports` for the locations of exports, whether it is safe to drop exports (its pretty conservative), and also whether `__esModule` is present. -
Benjamin Woodruff authored
Noticed while reading through the symlink code. The symlink logic had some clever `ErrorKind::AlreadyExists` logic that folded the retry into the main retry loop, but we still had a separate retry loop for after handling `ErrorKind::NotFound`. This folds the loops together. I hand-implemented the symlink version of this and had opus port it to the non-symlink version.
-
Marcos Hernanz authored
## Summary Run all Rust workspace doctests as part of the existing Turbo-cached cargo unit test task so future documentation regressions fail CI without adding an uncached workspace build. ## Verification - `cargo test --workspace --doc --profile=release-with-assertions --no-fail-fast` - Not run: `pnpm --filter=@next/swc test-cargo-unit` (`cargo-nextest` is installed in CI but unavailable locally; the new doctest suffix passed independently) <!-- NEXT_JS_LLM -->
-
Aurora Scharff authored
## Summary <img width="1304" height="1546" alt="CleanShot 2026-07-19 at 01 07 57@2x" src="https://github.com/user-attachments/assets/b9a6a7c9-dc95-42d5-9cce-f29e6d869d92" /> Adds a "Set up your editor" section to the App Router installation guide. The App Router names files by convention (`page.tsx`, `layout.tsx`, `route.ts`), so an editor quickly fills with same-named tabs. This section shows how to tell them apart with VS Code / Cursor custom editor labels, labeled two folders deep so dynamic routes like `blog/[id]/page.tsx` do not all collapse to the same `[id]` label. It includes: - A copy-paste `.vscode/settings.json` config (`workbench.editor.customLabels.patterns`) for setting it up by hand. - A copyable prompt that points a coding agent back at this section to apply the config, including adapting it to other editors. - A good-to-know that JetBrains IDEs (WebStorm, IntelliJ) do this automatically. ## Verification - Previewed locally against the docs site: the section renders (HTTP 200), with the config block, the prompt card, and the good-to-know all rendering correctly. <!-- NEXT_JS_LLM_PR -->
-
Manoraj K authored
### What? Fix the `cms-contentful` example to use the async APIs introduced in Next.js 15: - Await `draftMode()` in `app/page.tsx`, `app/posts/[slug]/page.tsx`, and `app/api/disable-draft/route.ts` - Update `params` type to `Promise<{ slug: string }>` and await it in `app/posts/[slug]/page.tsx` ### Why? In Next.js 15, `draftMode()` from `next/headers` became async and must be awaited. Page `params` are also now typed as a `Promise`. The example was using the old synchronous patterns, causing the build to fail and the app to not work when running against the latest version of Next.js -- this example project uses latest version of next.js in the package.json. ### How? Awaited `draftMode()` at each call site and updated the `params` type signature to `Promise<{ slug: string }>` with a corresponding `await`. Closes NEXT- Fixes # -
Niklas Mischkulnig authored
Keep reading `config.experimental.outputHashSalt` for now to not break existing adapters until they are migrated.
-
Niklas Mischkulnig authored
Keep reading `config.experimental.supportsImmutableAssets` for now to not break existing adapters until they are migrated. Closes NAR-868
-
Sebastian "Sebbie" Silbermann authored
-
- 19 Jul, 2026 2 commits
-
-
next-js-bot[bot] authored
-
Vercel Release Bot authored
Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-