1. 17 Jul, 2025 13 commits
    • nextjs-bot's avatar
      v15.4.2-canary.7 · bbddbeeb
      nextjs-bot authored
      bbddbeeb
    • Maia Teegarden's avatar
      Add trigger for v0 sync workflow (#81645) · 53a92f87
      Maia Teegarden 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 #
      
      -->
      53a92f87
    • Joshua Hannaford's avatar
      fix(turbopack) Adjust the way catchall routes are handled when a more specific… · a87a0721
      Joshua Hannaford authored
      fix(turbopack) Adjust the way catchall routes are handled when a more specific parallel route exists (#81634)
      
      ## Improve App Router Route Prioritization
      
      ### What?
      Fixed a logic bug where we were failing to correctly identify routes as
      catchall routes due to treating parallel routes as a completed route
      path. This shouldn't happen because parallel routes do not affect the
      routing structure.
      
      ### How?
      
      - Modified the route selection logic to more clearly prioritize specific
      routes over catch-all routes
      - Make sure we only count true leaf nodes when determining when to use
      the catch-all. Parallel is not a leaf node
      - Added a test case to ensure middleware rewrites and redirects work
      correctly with both parallel and non-parallel catch-all routes.
      
      Fixes #PACK-4490
      a87a0721
    • Zack Tanner's avatar
      bugfix: static resources staleTime should be renewed once refetched (#81771) · 65e0b7b7
      Zack Tanner authored
      When the `x-nextjs-staletime` header is sent from the server, the client
      router was discarding all of its staleTime heuristics (such as
      lastUsedTime and "reusable" cache entries). This caused an issue where
      after the static staleTime window expired and the prefetch data was
      renewed, the static staleTime itself was not being renewed.
      
      As a result, once the static staleTime expired, the client would
      continuously refetch the resource on every navigation, even though it
      had just been renewed.
      
      This removes the `x-nextjs-staleTime` logic from this heuristic because
      it was only intended to be considered for the new `clientSegmentCache` &
      cache components work
      65e0b7b7
    • nextjs-bot's avatar
      v15.4.2-canary.6 · 8a4abf7d
      nextjs-bot authored
      8a4abf7d
    • Wyatt Johnson's avatar
      fix: revert client segment route changes for sub shell generation (#81740) · 5b998d69
      Wyatt Johnson authored
      ### What?
      
      Implements a new sortable routes system that distinguishes between
      source pages and rendered pages for sub-shell generation.
      
      ### Why?
      
      The existing route sorting logic in Next.js doesn't account for the
      distinction between the original page definition (`sourcePage`) and the
      final rendered route (`page`). This is critical for sub-shell
      generation, given this example:
      
      | Page | Source Page |
      |--------|--------|
      | `/en/[teamSlug]/[projectSlug]/monitoring` |
      `/[lang]/[teamSlug]/[projectSlug]/monitoring` |
      | `/fr/[teamSlug]/[projectSlug]/monitoring` |
      `/[lang]/[teamSlug]/[projectSlug]/monitoring` |
      | `/[lang]/[teamSlug]/~/monitoring` | `/[lang]/[teamSlug]/~/monitoring`
      |
      
      And a request to `/en/vercel/~/monitoring` that it will hit the
      `/[lang]/[teamSlug]/~/monitoring` page instead of the
      `/en/[teamSlug]/[projectSlug]/monitoring`. This is because we first need
      to sort by the Source Page and then the Page to ensure that the correct
      route ordering is respected.
      
      ### How?
      
      - Adds new `SortableRoute` type that tracks both `sourcePage` and `page`
      - Implements depth-first route comparison algorithm that properly
      handles segment specificity
      - Refactors build process to use the new sorting functions instead of
      legacy `getSortedRoutes`
      - Adds source page tracking for PPR-enabled routes with
      `clientSegmentEnabled`
      - Includes comprehensive test coverage for all route sorting scenarios
      
      The new sorting algorithm ensures consistent route ordering across
      builds and proper sub-shell generation behavior.
      5b998d69
    • Niklas Mischkulnig's avatar
      Turbopack: include more details in panic (#81773) · cff812b4
      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 #
      
      -->
      cff812b4
    • Niklas Mischkulnig's avatar
      Turbopack: consistently name runtime chunk (#81769) · a093d32d
      Niklas Mischkulnig authored
      Name runtime chunks like this: `bench/basic-app/.next/static/chunks/turbopack-5356a889447ffe6d.js`
      a093d32d
    • Benjamin Woodruff's avatar
      feat(turbopack): Log anonymized internal error (panic) information to telemetry (#81272) · 3a5d293c
      Benjamin Woodruff authored
      ## Goals
      
      - Pass through a custom `TurbopackInternalError` type when a Rust panic or an unexpected top-level `anyhow::Error` occurs.
      - Make a best-effort attempt to log a location of the error to telemetry.
        - In the case of a panic, we should have the file, line, and column where the panic occured. This could be obscured inside of a helper method, but it's better than nothing. Since this is a position in Turbopack's source code, there's zero risk of user data being included here, so it should be safe to log to telemetry.
      
      ## How it works
      
      In previous PRs, @wbinnssmith did the following:
      - Added a thread-local for storing the most recent panic information in Rust
      - Added `catch_unwind` logic to intercept the panic in turbo-tasks and read the thread-local information, with care take to make sure we're reading from the same thread (not across an `await` boundary).
      - Added a custom `std::error::Error` type for internal errors, with support for storing information about a source panic.
      - Ensured we set up `Error::source` correctly everywhere so that you can trace an error back to the root cause (presumably a panic).
      
      In #80881, I added a `NextTurbopackContext` type that we can extend to store additional helpers on.
      
      In this PR:
      - Adds a callback to the `Project` constructor called `throwTurbopackInternalError` that constructs and throws a custom `TurbopackInternalError`. The definition of `TurbopackInternalError` must be in JS, as we cannot reasonably define the error subclass using NAPI.
      - Wraps the callback in a `ThreadsafeFunction` so that it can be called in any of our async functions.
      - Replaces all the places we were previously converting to `napi::Error` with logic to run `throwTurbopackInternalError`.
      
      In a subsequent PR, we could move more of the panic handling into JS using `throwTurbopackInternalError`.
      
      ## Testing
      
      Added a panic and ran:
      
      ```
      NEXT_TELEMETRY_DEBUG=1 pnpm next dev --turbopack examples/basic-css/
      ```
      
      <img src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/7f261d3f-351e-436a-9345-fd6e9056d20c.png" width="600">
      3a5d293c
    • Jiachi Liu's avatar
      [chore] bump zod to latest v3 (#81757) · f8afa172
      Jiachi Liu authored
      Update zod v3 to latest. Noticed this while playing with ai sdk as it's requires new versions of zod. Hence realized we haven't updated for a while. Bump to newer versions of `zod@3`
      f8afa172
    • Niklas Mischkulnig's avatar
      Remove unnecessary await (#81761) · b7eff6de
      Niklas Mischkulnig authored
      b7eff6de
    • Sebastian "Sebbie" Silbermann's avatar
    • Jiachi Liu's avatar
      [devtool] enable segment explorer by default (#81737) · 10fb5bc6
      Jiachi Liu authored
      Enable `experimental.devtoolSegmentExplorer` on canary by default and update snapshots
      10fb5bc6
  2. 16 Jul, 2025 27 commits