- 07 Aug, 2025 11 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
As discussed we can move these tests to run on canary release instead of on every PR. x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1754522330101839?thread_ts=1754493332.436339&cid=C02CDC2ALJH)
-
Jiachi Liu authored
-
Josh Story authored
Prior to this change on every navigation we would validate that the initial static shell satisified the rules of cache components. This offers more protection as you edit pages but it slows down navigations and we are already concerned with dev speed and the extra CPU contention can potenially hide or exacerbate other performance characteristics you might notice in dev. So for now we will only validate a page on initial load. This means that if you are trying to debug a page's static shell suitability you will need to refresh the page not just navigate to and from it.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Niklas Mischkulnig authored
Showed up in an ast-grep search for `&$$$.clone()`
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Niklas Mischkulnig authored
-
Maia Teegarden authored
Before: Cron runs would open a Draft PR if they happened to run before deployment tests finished. Once deployment tests completed, the system would either open a PR and immediately close it (if tests failed) or open it as ready for review (if tests passed). After: Both cron runs and new releases will open Draft PRs. Once deployment tests run and pass, these PRs will be marked as ready for review. If tests fail, the PRs remain as drafts. Related PRS: https://github.com/vercel/v0/pull/12992 https://github.com/vercel/front/pull/50036
-
Joseph authored
Complement to: https://github.com/vercel/next.js/issues/82379 Also adding corrections to other sections
-
Andrew Clark authored
Removes the param values from the router tree sent by the server during a client-side prefetch. This increases the cacheability of prefetch responses because if the response does not include a certain param in the component data, it can be reused for all possible values of that param. Previously this was not possible because even if the components did not reference a param, it was included in the router tree regardless. This does not affect the router tree sent during dynamic navigations, or during initial render. We should remove the param values from those responses, too, both for consistency and to increase the cacheability of HTML fallback responses. That work will land in future PRs.
-
- 06 Aug, 2025 15 commits
-
-
nextjs-bot authored
-
Zack Tanner authored
This PR fixes an infinite loop bug that occurred when using `cacheLife({ stale: 0 })` with `clientSegmentCache`. When the server returned a stale time of 0 seconds, cache entries would have `staleAt = Date.now()`, making them immediately stale. The cache would evict these entries on the same tick they were created, triggering continuous refetch requests. The fix updates the minimum stale time to be 30s, in the event that the server sends a low value. The rationale being that a value lower than 30s here would render prefetching ineffective. This prevents the immediate eviction while still respecting the server's intent for very short-lived cache entries. Closes NAR-269 -
Andrew Clark authored
Small update to #82383. Instead of using a special symbol to represent the "virtual" segments that get inserted into the loader tree for parallel routes, we can represent them like route groups, since they serve the same purpose. That will allow us to remove a special case in the param parsing logic, since we have to skip groups regardless; both will be skipped by the same check.
-
zoomdong authored
When use externalType: `global` or `script` under utoopack(turbopack only use esm or cjs external): like externalType is global , and the external package is react. The generate external module code like: ```ts 263: ((__turbopack_context__) => { "use strict"; const mod = globalThis["react"]; __turbopack_context__.n(mod); }), ``` The real function of runtime code `__turbopack_context__.n` is `exportNamespace`, its code as follows: ```ts module.exports = module.namespaceObject = namespace ``` And when we import the module as following: ```ts import react from "react"; console.log(react.version); ``` it will be bundled as: ```ts var __TURBOPACK__imported__module__263__ = __turbopack_context__.i(263); console.log(__TURBOPACK__imported__module__263__["default"]); ``` The `__turbopack_context__i` is esmImport, it will return the module when the module contains `namespaceObject` without `interopEsm`: ```ts function esmImport() { const module = getOrInstantiateModuleFromParent(id, this.m) // any ES module has to have `module.namespaceObject` defined. if (module.namespaceObject) return module.namespaceObject return interopEsm(); } ``` So the following case if we use a react umd module(which doesn't have a `default export`) as our external package, code `console.log(__TURBOPACK__imported__module__263__["default"]);` will output `undefined`(which webpack can output the right version). I just change export wrapper the externalType: global and script here(which now only consumed by utoopack), so the esmImport will execute `interopEsm` function here to make our code work fine. We test the case under utoopack and here is our pr: https://github.com/umijs/mako/pull/2097/files. --------- Co-authored-by:Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Joseph authored
Closes: https://linear.app/vercel/issue/DOC-4862/tailwind-css-modules --------- Co-authored-by:
Rich Haines <hello@richardhaines.dev>
-
Janka Uryga authored
Closes NAR-262
-
Janka Uryga authored
`unstable_isUnrecognizedActionError` is a new API that lets user code check if a server action call failed because the action id wasn't recognized by the server. This usually happens as a result of version skew between client and server. Example usage: ```ts try { await myServerAction(); } catch (err) { if (unstable_isUnrecognizedActionError(err)) { // The client is from a different deployment than the server. // Reloading the page will fix this mismatch. window.alert("Please refresh the page and try again"); return; } } ``` It can also be used to create a special error boundary, like we do in the tests added here. Note that this API is not a complete solution to this problem, as it doesn't allow handling failures for MPA actions (sent without JS). We might add a more complete API for this in the future to address that. -
Jiwon Choi authored
Rspack `testing for test/development/tsconfig-path-reloading` is failing often these days. Noticed `test/development/jsconfig-path-reloading` is already in the manifest of the "failed" section. - [Failed CI](https://github.com/vercel/next.js/actions/runs/16671025870/job/47187245042?pr=81396#step:34:504) - [DataDog](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40test.service%3Anextjs%20%40test.status%3Afail%20%40test.name%3A%28%22tsconfig-path-reloading%20tsconfig%20added%20after%20starting%20dev%20should%20automatically%20fast%20refresh%20content%20when%20path%20is%20added%20without%20error%22%20OR%20%22tsconfig-path-reloading%20tsconfig%20should%20automatically%20fast%20refresh%20content%20when%20path%20is%20added%20without%20error%22%29&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&index=citest&start=1753875198762&end=1754479998762&paused=false)
-
Andrew Clark authored
This will be used to roll out an internal implementation change; it won't ever be a user-facing configuration. The plan is to remove it as soon as the feature is properly tested.
-
Sebastian "Sebbie" Silbermann authored
-
Joseph authored
Fixes: https://github.com/vercel/next.js/issues/82379 Also fixing the Metadata snippets at the bottom of the page
-
Joseph authored
Feedback on the csp guide updates
-
nextjs-bot authored
-
- 05 Aug, 2025 14 commits
-
-
Steven authored
Fonts were not protected from version skew so this PR fixes it https://nextjs.org/docs/14/app/building-your-application/deploying#version-skew
-
nextjs-bot authored
-
Zack Tanner authored
When constructing the loader tree for parallel route segments, we inject a `children` segment, which could contain things like slot level layout/error/loading files. We want a way to distinguish between these virtual segments that exist just for organizational purposes rather than relying on `children`. This updates the loader tree construction code to give these more unique names. In the future, we should see if we can remove the need for this virtual segment if there are no special files needed at that segment of the tree.
-
Niklas Mischkulnig authored
To pull in a minifier bugfix: https://github.com/swc-project/swc/pull/10950 Fixes error locations again: https://github.com/swc-project/swc/issues/10930 https://vercel.slack.com/archives/C02HY34AKME/p1753429211338319 Blocked on https://github.com/swc-project/plugins/pull/514
-
Joshua Hannaford authored
-
Jiwon Choi authored
### Why? The issue was brought up when the app had rewrites (say `/ -> /foo`), and the page used `useRouter.push/replace` to add the search queries; it used the destination's pathname (`/foo?query=1`) instead of just adding the query (`/?query=1`). Current Behavior: https://github.com/vercel/next.js/actions/runs/16647831682/job/47112716254?pr=82236#step:34:156 ### How? Therefore, as we handle the hash (`#`), if the target path only needs a query `?`, we may use `router.asPath` by default for static routes to resolve cases with rewrites. However, if it is a dynamic route, it needs to be able to interpolate the query (for `/[id]` segment, `/?id=1` interpolates to `/1` route), so use `router.pathname`. Finally, if it is suspected to be a rewritten path, use `router.asPath`. **Note:** There is an edge case where the pathname is dynamic, and also a rewrite path to the same segment. E.g. in `/[slug]` path, rewrite `/foo -> /bar` In this case, it will be treated as a non-rewritten path and possibly interpolate the query string. E.g., `/any?slug=foo` will become the content of `/foo`, not rewritten as `/bar`. This is currently a trade-off of not resolving rewrite paths on every Router/Link call, but using a lighter route regex pattern check. Fixes https://github.com/vercel/next.js/issues/81476
-
Jiwon Choi authored
In minimal mode, if there was `/[slug].js` with `notFound: true` on the same segment of `_error.js`, `req.url` and `ctx.asPath` were returned as `/[slug]`, since it was re-initialized to the request url. Therefore, don't re-initialize the URL if it is in minimal mode && is the `_error` page. Fixes NEXT-4660 --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
xusd320 authored
feat(turbopack): improve compile-time define value to support more data types and expr evaluation (#81042) Co-authored-by:graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
-
Josh Story authored
When creating spans with OTel random values must be created to follow the OTel spec and is expected in practical implementations. While it is a loose concession Next.js will allow spans to be created while prerendering that have ids generated with random values. and by reading the current time from the system clock. This is pragmatic but potentially risky because if you are not careful and for instance wrap a "use cache" function in a span it is possible you will accidentally pass the span into the cache function causing it to miss on every invocation due to the random nature of one of it's arguments. To defend against this we do check whether `startActiveSpan` is being passed a Cache Function. However it is easy to circumvent by wrapping it in an intermediate function or by using startSpan and context.with yourself. In the long run we should consider tainting the Span objects created in these scopes so they cannot be sent through to a cache. I will consider a follow up PR to land this if we determine taint is likely to be stabilized in React. The pratical implementation of this change is to patch the tracer provider so that it always provides a patched tracer which exits the workUnitStorage on span start/creation and re-enters the scope on inner function exectuion.
-
Michal authored
The PR fixes issues in two different guides. ### PPR In PPR, the code for jsx and tsx versions should use the language switcher. Currently, these are displayed below each other in the guide which seems unintentional. ### ISR This change fixes multiple issues: **fixes in the example:** the example currently does not match the text below (_Here's how this example works:_). It says: > If /blog/26 is requested, Next.js will generate and cache this page on-demand that is of course not correct because there are only 25 blog posts returned from the API. No blog post data is returned for `/blog/26`, making this example wrong and confusing. By slicing the posts and supplying only 24 of 25 blog posts for static generation during the build process, the guide becomes much more explicit - the 25th blog post can be used for inspecting the workings of the on-the-fly generation and caching. Turning `dynamicParams` to `false` or `true`, one can now truly test this behaviour with the 25th blog. Second, the same example in Pages Router docs includes: > return { paths, fallback: false } In this case, again, this part below: > If /blog/26 is requested, Next.js will generate and cache this page on-demand is incorrect. When setting `fallback` to `false`, the page is never generated on-demand and returns 404 instead as there is no 26th blog post in the fetched data. So the fix changes the value of `fallback` to `blocking`, to mirror the App Router's `dynamicParams` value in the guide. This makes is more consistent and, more importantly, reproducible example. **clarifying the on-demand section:** The sections dedicated to **on-demand revalidation** do not currently mention that revalidation works differently from the time-based one. One may assume the first request after on-demand revalidation returns stale data (just like time-based). But that's not true, the next request after on-demand revalidation (with Server Actions for example) generates the content on-the-fly and returns fresh data right away. It wasn't clear to me so I tested it myself and was surprised (and happy) that it is this smart. I think it's very important to clarify this distinction in the guide. ----- I hope this makes sense. I'm quite responsive these days and will change it based on your feedback (if any). Thanks! <!-- 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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>
-
Jiwon Choi authored
For cases when the root span's status returned 500, the span status returned `OK`. This results in inaccurate telemetry, as users may expect the span to indicate an error when a 500 occurs. Failed CI: https://github.com/vercel/next.js/actions/runs/16633984270/job/47070403977?pr=82212#step:34:427 Also, the OTel documentation states: > For HTTP status codes in the 5xx range, as well as any other code the client failed to interpret, span status SHOULD be set to Error. x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status Therefore, set the root span to `Error` when the status is in the 5xx range. In addition, as the document states: > When instrumentation detects such errors it SHOULD set span status to Error and SHOULD set the error.type attribute. Added `error.type` attributes to places where sets `Error` span status. Fixes NEXT-4668
-
Niklas Mischkulnig authored
I looked through all TODOs if there are any remaining "todo fix this for prod builds"-style comments, but there weren't any. But some of them are outdated now
-
xusd320 authored
-
Niklas Mischkulnig 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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 # -->
-