- 16 Dec, 2024 18 commits
-
-
vercel-release-bot authored
-
Sam Ko authored
## Why? The automated comment should be a paragraph, not a single line code-snippet.
-
Hendrik Liebau authored
As a follow-up to #73975, we're now restoring the error handling for failed RSC fetch calls when the user navigates back after a hard navigation. In this case the browser uses the bfcache to restore the previous JavaScript execution context, and thus the abort controller will still be in the aborted state. To take this into account, we're now creating a new `AbortController` instance on `'pageshow'` events. In addition, the abort controller's `signal` is now actually passed to the `fetch` call, and not only used for the error handling, so that the requests are aborted on `'pagehide'`. This was an oversight in the original PR. With that, it's even more important to create a fresh abort controller, otherwise RSC fetching would be disabled after back navigation. The added e2e test can only run in headed mode unfortunately, as the bfcache is not available in headless mode. (Using the same approach as in #54081.)
-
Jiwon Choi authored
This PR enabled feature flag for the new dev overlay, no behavioral change. - Added `experimental.newDevOverlay` Next.js option, which handles `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` env value. - Added `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` env to be resolved at build time so that it can be used to render the overlay conditionally
-
Benjamin Woodruff authored
refactor(turbo-tasks-macros): Strip (already hidden) doc attributes from inline function signatures (#73931) A minor optimization to the generated code. We were duplicating doc comments on the hidden `_turbo_tasks_function_inline` versions of functions. We only need the docs on the public function. This change should mean *slightly* less code for the macro to emit, and *slightly* less code for rustc to parse. ## Before ``` // =========================================== // Recursive expansion of the value_impl macro // =========================================== impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] pub fn immutable() -> Vc<Self> { let inputs = std::boxed::Box::new(()); let persistence = turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs); <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call( *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID, inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>, persistence, )) } } #[doc(hidden)] impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] #[doc(hidden)] #[deprecated( note = "This function is only exposed for use in macros. Do not call it directly." )] pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> { Completion::cell(Completion) } } #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy< turbo_tasks::NativeFunction, > = turbo_tasks::macro_helpers::Lazy::new(|| { #[allow(deprecated)] turbo_tasks::NativeFunction::new_function( "Completion::immutable".to_owned(), turbo_tasks::FunctionMeta { local_cells: false }, <Completion>::immutable_turbo_tasks_function_inline, ) }); #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy< turbo_tasks::FunctionId, > = turbo_tasks::macro_helpers::Lazy::new(|| { turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION) }); ``` ## After ``` // =========================================== // Recursive expansion of the value_impl macro // =========================================== impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] pub fn immutable() -> Vc<Self> { let inputs = std::boxed::Box::new(()); let persistence = turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs); <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call( *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID, inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>, persistence, )) } } #[doc(hidden)] impl Completion { #[doc(hidden)] #[deprecated( note = "This function is only exposed for use in macros. Do not call it directly." )] pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> { Completion::cell(Completion) } } #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy< turbo_tasks::NativeFunction, > = turbo_tasks::macro_helpers::Lazy::new(|| { #[allow(deprecated)] turbo_tasks::NativeFunction::new_function( "Completion::immutable".to_owned(), turbo_tasks::FunctionMeta { local_cells: false }, <Completion>::immutable_turbo_tasks_function_inline, ) }); #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy< turbo_tasks::FunctionId, > = turbo_tasks::macro_helpers::Lazy::new(|| { turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION) }); ``` -
Benjamin Woodruff authored
After the toolchain upgrade, causing a compilation error in a `#[turbo_tasks::value]` (or somewhere adjacent) can cause this additional non-fatal compilation warning/note: ``` note: erroneous constant encountered --> crates/next-api/src/project.rs:580:1 | 580 | #[turbo_tasks::value_impl] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ in this procedural macro expansion | ::: /home/bgw.linux/next.js/turbopack/crates/turbo-tasks-macros/src/lib.rs:119:1 | 119 | #[proc_macro_error] | ------------------- in this expansion of `#[turbo_tasks::value_impl]` ``` The use of const expressions here was a little whacky. This removes the need for the const associated items by inlining their (one and only) use later when creating the `Lazy` static. This simplifies the macro implementation, reduces the total resulting code size, and makes the expanded output a little more legible. ## Before ``` // =========================================== // Recursive expansion of the value_impl macro // =========================================== impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] pub fn immutable() -> Vc<Self> { let inputs = std::boxed::Box::new(()); let persistence = turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs); <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call( *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID, inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>, persistence, )) } } #[doc(hidden)] impl Completion { #[allow(declare_interior_mutable_const)] #[doc(hidden)] const COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy< turbo_tasks::NativeFunction, > = turbo_tasks::macro_helpers::Lazy::new(|| { #[allow(deprecated)] turbo_tasks::NativeFunction::new_function( "Completion::immutable".to_owned(), turbo_tasks::FunctionMeta { local_cells: false }, <Completion>::immutable_turbo_tasks_function_inline, ) }); #[allow(declare_interior_mutable_const)] #[doc(hidden)] const COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy< turbo_tasks::FunctionId, > = turbo_tasks::macro_helpers::Lazy::new(|| { turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION) }); #[doc = " This will always be the same and never invalidates the reading task."] #[doc(hidden)] #[deprecated( note = "This function is only exposed for use in macros. Do not call it directly." )] pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> { Completion::cell(Completion) } } #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy< turbo_tasks::NativeFunction, > = <Completion>::COMPLETION_IMPL_IMMUTABLE_FUNCTION; #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy< turbo_tasks::FunctionId, > = <Completion>::COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID; ``` ## After ``` // =========================================== // Recursive expansion of the value_impl macro // =========================================== impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] pub fn immutable() -> Vc<Self> { let inputs = std::boxed::Box::new(()); let persistence = turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs); <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call( *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID, inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>, persistence, )) } } #[doc(hidden)] impl Completion { #[doc = " This will always be the same and never invalidates the reading task."] #[doc(hidden)] #[deprecated( note = "This function is only exposed for use in macros. Do not call it directly." )] pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> { Completion::cell(Completion) } } #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy< turbo_tasks::NativeFunction, > = turbo_tasks::macro_helpers::Lazy::new(|| { #[allow(deprecated)] turbo_tasks::NativeFunction::new_function( "Completion::immutable".to_owned(), turbo_tasks::FunctionMeta { local_cells: false }, <Completion>::immutable_turbo_tasks_function_inline, ) }); #[doc(hidden)] pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy< turbo_tasks::FunctionId, > = turbo_tasks::macro_helpers::Lazy::new(|| { turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION) }); ``` -
Jiachi Liu authored
-
김용민 authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
YeonHee authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
YeonHee authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Benjamin Woodruff authored
This should let GitHub (and Graphite) collapse these files by default in code review. ``` $ git check-attr --all crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/* crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/output-data.js: linguist-generated: true crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/output-default.js: linguist-generated: true ```
-
Jude Gao authored
-
Hendrik Liebau authored
When the user reloads the page or navigates away while RSC fetch requests are still in flight – most notably background prefetches – we currently log the following error: ``` Failed to fetch RSC payload for <URL>. Falling back to browser navigation. ``` This unnecessarily clutters the DevTools console and creates noise in remote error reporting tools. When the browser cancels a `fetch` request due to navigation, it throws `TypeError: Failed to fetch`. We shouldn't universally suppress this error since it may also occur for other valid reasons where we do want to log it. To suppress the error only in genuine navigation scenarios, we introduce an `AbortController` and pass its signal to the `fetch` call. On `'pagehide'` events, we abort the controller. This approach ensures that error log suppression is limited solely to these navigation-related cases. [x-ref](https://vercel.slack.com/archives/C0676QZBWKS/p1734009715952909) fixes #60549
-
Niklas Mischkulnig authored
Same problem as https://github.com/vercel/next.js/pull/72453, once again.
-
Jam Balaya authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Jam Balaya authored
-
Attila Repka authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
David Hu authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
- 15 Dec, 2024 8 commits
-
-
vercel-release-bot authored
-
Aymeric PINEAU authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Jam Balaya authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Jam Balaya authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Jam Balaya authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Jam Balaya authored
Co-authored-by:Lee Robinson <me@leerob.io>
-
Delba de Oliveira authored
Fix typo in examples page
-
- 14 Dec, 2024 5 commits
-
-
vercel-release-bot authored
-
Jiwon Choi authored
### Why? The user's `silenceDeprecations` option was not overwritten in turbopack, only the `legacy-js-api` was passed. Thanks to @mzronek for reporting at https://github.com/vercel/next.js/issues/71638#issuecomment-2539967913! Co-authored-by:
Donny/강동윤 <kdy1997.dev@gmail.com>
-
Niklas Mischkulnig authored
After https://github.com/vercel/next.js/pull/73614, an empty env var also enabled tracing: `NEXT_TURBOPACK_TRACING= next dev` Now that empty env var is ignored entirely. This is useful because it you can easily switch between tracing and non-tracing builds as you don't have to retype the long env var name And apparently, the napi-rs version bump had also caused a different typedef generation that wasn't commited yet
-
Wyatt Johnson 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 # -->
-
Sam Ko authored
## Why? Adding a section dedicated to dynamically importing MDX files inside pages for App Router. - x-ref: https://github.com/vercel/next.js/discussions/70417 --------- Co-authored-by:
Lee Robinson <me@leerob.io>
-
- 13 Dec, 2024 9 commits
-
-
Sam Ko authored
## Why? Mini-automation to automatically close issues when using the `please use the correct issue template` label.
-
vercel-release-bot authored
-
Hendrik Liebau authored
In #73891 we added another manifest to be loaded in `loadComponents` (initially unconditionally). This uncovered a flakiness in prod mode when attempting to load an optional manifest. The non-existent manifest is attempted to be loaded three times with 100ms delay between attempts, before giving up. For some reason the increased loading time leads to more test flakiness. To mitigate this, we're limiting the retry behaviour to the dev mode, which matches the original intention when this was introduced in #45244.
-
Oliver Wickham authored
Super simple typo `Optmizing` -> `Optimizing` <!-- 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:
JJ Kasper <jj@jjsweb.site>
-
Steven authored
We typically add `search: ''` on `remotePatterns` to disallow the query string, which is the most common case. There were a few missing places in the docs so this PR fills in those gaps.
-
vercel-release-bot authored
-
Abdón Rodríguez 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 # --> ### What? Update `WebVitals` component. ### Why? In the `useReportWebVitals` documentation: https://nextjs.org/docs/app/api-reference/functions/use-report-web-vitals <img width="681" alt="Screenshot 2024-12-12 at 4 35 27 PM" src="https://github.com/user-attachments/assets/afaf6450-e6f0-4351-8e5e-2cad343886a9" /> If you do it in a TypeScript project, you have this error: <img width="864" alt="Screenshot 2024-12-12 at 3 49 07 PM" src="https://github.com/user-attachments/assets/7cd973d1-a447-4afb-be2d-6e6429b859ac" /> ``` 'WebVitals' cannot be used as a JSX component. Its type '() => void' is not a valid JSX element type. Type '() => void' is not assignable to type '(props: any, deprecatedLegacyContext?: any) => ReactNode'. Type 'void' is not assignable to type 'ReactNode'.ts(2786) ``` ### How? Returning null solves the problem. Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
Steven authored
These features were added in Next.js 15.x but then back-ported to 14.x since they can impact billing. So we should land this docs PR and then also back-port it. I also noticed that the heading was wrong for `localPatterns`.
-
Zack Tanner authored
This isn't in use anymore since we moved these errors to a swc transform.
-