1. 18 Jul, 2025 20 commits
    • nextjs-bot's avatar
      v15.4.2-canary.9 · e5711ab6
      nextjs-bot authored
      e5711ab6
    • Jiwon Choi's avatar
      [devtools] restart server pending state (#80858) · e26fad47
      Jiwon Choi authored
      This PR adds a pending state to the clear bundler cache & server
      restart.
      
      When the user clicks the restart server button, Next.js fetches
      `/__nextjs_server_status` for the current server's execution ID. Then it
      queries `/__nextjs_restart_dev` middleware to trigger the server
      restart, then polls the `/__nextjs_server_status` path to confirm the
      server execution ID differs, which means the new server is online.
      
      When the server has restarted, reload the window.
      
      Closes NEXT-4562
      Closes NEXT-4501
      
      ---------
      Co-authored-by: 's avatarJiachi Liu <inbox@huozhi.im>
      e26fad47
    • Wyatt Johnson's avatar
      fix(ppr): ensure fallback route params trigger dynamic resume (#81812) · 5c7daf5a
      Wyatt Johnson authored
      ### What?
      
      This PR fixes an issue where pages with fallback route params weren't
      triggering dynamic resume behavior in PPR (Partial Pre-Rendering).
      
      ### Why?
      
      When fallback route params exist, the RSC (React Server Components) data
      is inherently dynamic because the params are encoded into the flight
      router state. Without this fix, pages with fallback route params would
      incorrectly be treated as fully static, leading to incorrect behavior.
      
      ### How?
      
      - Added a check in `app-render.tsx` to ensure that pages with fallback
      route params (`workStore.fallbackRouteParams.size > 0`) always perform a
      dynamic resume after the static prerender
      - Refactored PPR tests to use deterministic sentinel markers (`<\!--
      PPR_BOUNDARY_SENTINEL -->`) instead of time-based measurements for more
      reliable testing
      - Updated the test utilities to split responses based on the sentinel
      marker rather than timing delays
      
      This ensures that:
      1. Pages with fallback route params correctly trigger dynamic behavior
      2. PPR tests are more reliable and deterministic
      3. The boundary between static and dynamic content is clearly marked in
      test mode
      
      Fixes #
      5c7daf5a
    • Jiachi Liu's avatar
      [devtool] fix scrollbar styling (#81814) · d3ed546f
      Jiachi Liu authored
      * The scrollbar styling was lost before while we enabling the draggable panel. Share that styles between all scrollable content
      * Migrate the inline style to css and dynamic css into css variables, so we'll create less dynamic object during rendering.
      
      <video src="https://github.com/user-attachments/assets/df63169f-4846-4c53-91b4-3ca0585dd76d" width="400">
      d3ed546f
    • Jiachi Liu's avatar
      [segment explorer] hide for pages router (#81813) · afec9909
      Jiachi Liu authored
      Hide the segment explorer menu item in pages router 
      
      Closes NEXT-4635
      afec9909
    • Luke Sandberg's avatar
      [turbopack] use `require` to load chunks in our node runtime (#81738) · 8a8888ca
      Luke Sandberg authored
      ## Use `require` to load chunks in node instead of readFile+eval
      
      The benefit of this is that we can slightly simplify chunk loading and make it easier for hosting services to cache bytecode.
      
      Much like [browsers](https://v8.dev/blog/code-caching-for-devs), server environments often leverage VM features to cache parsed javascript as bytecode (or maybe binary ast?) to accelerate cold starts ([example](https://vercel.com/blog/introducing-bytecode-caching-for-vercel-functions)), however, these systems generally avoid caching highly dynamic content like inline scripts and `eval` parameters.  
      
      So just use `require` which is what platforms expect!  This should help platforms achieve code caching, is generally simpler, and by not adding a prefix we fix some subtle off-by-one issue with source maps. 
      
      A slightly better solution imho would be `import()` since it would enable node to do some file reading parsing async with the main thread which could be important if there are multiple `preloadModules`, however this breaks dev mode hot reloading.
      
      Fixes #PACK-5062
      8a8888ca
    • rauno's avatar
      [dev-tools] Robust shortcut detection (#81756) · ae2c750d
      rauno authored
      This PR resolves NEXT-4610 by using `e.code` over `e.key` in both
      storing and detecting keyboard shortcuts.
      
      Consider this problematic keybind: Alt + L
      
      If we capture `e.key` here then it will correspond to a glyph (¬)
      because pressing Alt + L creates this character. While `e.code` will
      give us `KeyL` as the value which we also later use in `useShortcuts()`
      to match the keybind correctly without having to detect glyphs.
      
      ---
      
      After this PR:
      
      
      
      https://github.com/user-attachments/assets/222fc65f-7320-4487-b387-ea263acfe387
      ae2c750d
    • Jiachi Liu's avatar
      [devtool] migrate css reset to global.css (#81783) · 2dd023d4
      Jiachi Liu authored
      css reset component can stay in global.css now, no need to keep it as inline css component
      2dd023d4
    • nextjs-bot's avatar
      v15.4.2-canary.8 · a1493307
      nextjs-bot authored
      a1493307
    • Hendrik Liebau's avatar
      Refactor: Get rid of overly generic `getExpectedRequestStore` function (#81791) · 55e90412
      Hendrik Liebau authored
      The places in which we called `getExpectedRequestStore()` were already narrowing down the work unit store type to a request store. This allows us to delete the function, and call `throwForMissingRequestStore()` directly instead.
      55e90412
    • Niklas Mischkulnig's avatar
    • Hendrik Liebau's avatar
      Add VSCode tasks to show TypeScript compilation errors in problems view (#81799) · 298acda3
      Hendrik Liebau authored
      Showing compilation errors for files that aren't currently open is very useful during refactorings.
      
      https://github.com/user-attachments/assets/629f8f2a-37ba-44c1-be6d-9a2e0f93e4f1
      298acda3
    • Sebastian "Sebbie" Silbermann's avatar
    • nextjs-bot's avatar
    • Hendrik Liebau's avatar
      Properly handle hanging promise rejections during prerendering (#81754) · 2256b6be
      Hendrik Liebau authored
      We are using hanging promises for excluding request-specific data from a
      prerender. When prerendering is aborted, we reject all hanging promises.
      In dev mode, React uses these rejections to construct more detailed
      owner stacks. This allows us to provide better errors during the
      prerender validation.
      
      For this to work reliably, we need to ensure that all hanging promises
      are rejected after React's rendering is aborted. However, some hanging
      promises are created before React starts rendering (when creating the
      RSC component tree). Furthermore, for memory reasons, the first hanging
      promise adds a single abort listener that's shared with all subsequent
      hanging promises (see #77480). In this case, the shared abort listener
      for rejections is added before React can add its own abort listener.
      
      When using the same abort signal for both the React render and the
      hanging promises, the hanging promises would be rejected too early,
      preventing React from properly constructing the owner stacks.
      
      To ensure that the order of operations is correct, we now use a separate
      abort signal for React's rendering that is aborted before the "render
      signal" [^1], which is used by the hanging promises, is aborted. For
      parity, we're doing this not only in dev mode but also in production
      mode, so that the hanging promise rejection handling is always the same.
      
      Technically, I don't think this change is necessary for the SSR
      prerender pass, but it felt cleaner to apply it there as well. However,
      we could revisit that when we properly split the two prerender stores.
      For example, the `cacheSignal` and `prerenderResumeDataCache` also don't
      need to be present on the client prerender store.
      
      Reverts #81501.
      
      [^1]: This is an unfortunate name clash. We could also call this one
      "cache signal", which would be in line with `React.cacheSignal()` – its
      potential successor. But that clashes with our current `cacheSignal`,
      which tracks the cache reads. We might revisit this naming problem in a
      future PR.
      2256b6be
    • Wyatt Johnson's avatar
      refactor: rename experimental.dynamicIO to experimental.cacheComponents (#81562) · 8abbb3dc
      Wyatt Johnson authored
      ## What?
      
      Rename `experimental.dynamicIO` to `experimental.cacheComponents` across
      the Next.js codebase.
      
      ## Why?
      
      We're going to be merging the functionality of the `ppr`, `dynamicIO`
      and `useCache` experimental flags into the singular `cacheComponents`
      flag to reduce complexity of the codebase and simplify adoption for
      users wanting to experiment with experimental features.
      
      ## How?
      
      - Renamed the configuration option from `experimental.dynamicIO` to
      `experimental.cacheComponents`
      - Added deprecation handling with automatic migration for the old option
      name
      - Updated all documentation, tests, and internal references
      - Updated Rust code in SWC transforms and Turbopack
      - Maintained backward compatibility with deprecation warnings
      
      NAR-158
      8abbb3dc
    • Wyatt Johnson's avatar
      fix(build): add sourcePage context for PPR dynamic route lambda creation (#81781) · 290ecac9
      Wyatt Johnson authored
      ### What?
      
      This PR adds a `sourcePage` property to dynamic routes in the routes
      manifest to provide the necessary context for lambda creation during the
      build process when PPR is enabled.
      
      ### Why?
      
      The build process was missing the required context to properly create
      lambdas for dynamic routes when PPR is enabled. Without the source page
      information, the build couldn't determine which page a dynamic route
      originated from, preventing correct lambda generation.
      
      ### How?
      
      - Added a new `DynamicManifestRoute` type that extends `ManifestRoute`
      with an optional `sourcePage` property
      - Updated the `pageToRoute` function with overloads to pass the source
      page context
      - Modified the routes manifest generation to include the source page
      when creating dynamic routes for PPR-enabled pages
      - The `sourcePage` property is only populated for app pages when PPR is
      enabled (remains `undefined` for regular dynamic routes)
      
      This ensures the build process has the necessary context to create the
      underlying lambdas correctly.
      290ecac9
    • Benjamin Woodruff's avatar
      Turbopack: Split DynamicEqHash trait into smaller traits in a separate re-usable crate (#81741) · 2817a46d
      Benjamin Woodruff authored
      I originally split this off to support #81742, but I ended up rewriting that PR to not depend on this...
      
      However, I think this is still a code quality improvement, so I'm publishing the PR anyways.
      
      A few notable changes:
      
      - This is now three traits (`DynPartialEq`, `DynEq`, and `DynHash`) instead of one (`DynamicEqHash`)
      - The `Dyn` naming instead of `Dynamic` matches the more common Rust convention.
      - [Trait upcasting is finally stable!](https://blog.rust-lang.org/2025/04/03/Rust-1.86.0/#trait-upcasting) Remove the `.as_any()` idiom. Be very careful with the explicit derefs.
      - Fix a bug where the type id was getting added to the hash state twice (once by the `Hash` impl, and a second time by the `DynHash` impl).
      - The `HasherMut` struct isn't really needed, as you can use a `&mut &mut Hasher` instead to work around these dyn compatibility issues in the stdlib.
      
      And finally, `MagicAny` is ported to use these `Dyn` traits to dedupe some logic.
      2817a46d
    • Jiachi Liu's avatar
      [devtool] copy decoded info of error details (#81735) · 7d030a02
      Jiachi Liu authored
      Change the copy button's content from the original error stack trace to a prompt template with error details from the error page and ask AI to fix it. You can copy it for either bug reporting or asking AI agent to explain/fix the errors for you.
      
      ### Example content
      
      A runtime error prompt
      ```
      Fix this error in Next.js app:
      
      ## Error Type
      Runtime Error
      
      ## Error Message
      Error on client
          at Page (app/runtime-error/page.tsx:5:11)
      
      ## Code Frame
        3 | export default function Page() {
        4 |   if (typeof window !== 'undefined') {
      > 5 |     throw new Error('Error on client')
          |           ^
        6 |   }
        7 |   return <p>page</p>
        8 | }
      
      Next.js version: 15.4.2-canary.3 (Webpack)
      
      Explain what's wrong and fix it.
      ```
      
      ### Recordings
      
      | build error | runtime error |
      |:--|:--|
      | <video src="https://github.com/user-attachments/assets/f31c935e-797c-48c7-8e80-5c1bdcde7c5c"> | <video src="https://github.com/user-attachments/assets/15987538-af32-4a32-90e7-1bbf08f1d57b"> |
      7d030a02
    • Jiachi Liu's avatar
      [devtool] move font styling to global.css (#81782) · cf1b7194
      Jiachi Liu authored
      Since we have global css reset, we can only need to reset the font style once, not everywhere
      
      Closes NEXT-4628
      cf1b7194
  2. 17 Jul, 2025 15 commits
  3. 16 Jul, 2025 5 commits
    • nextjs-bot's avatar
      v15.4.2-canary.5 · 719bc5e7
      nextjs-bot authored
      719bc5e7
    • Jiachi Liu's avatar
      [devtool] fix duplicate rendered indicator on server (#81729) · 96b31f8e
      Jiachi Liu authored
      There're should be only one indicator rendered when `showIndicator` state is true, the previous condition is not correct since the previous change seem causing indicator always rendered even on SSR. since devtool bundle is also bundled on ssr layer, but the related code should not get executed. We noticed the previous condition will always render the indicator, which likely triggered some `base-ui` browser code to execute on server and crash on windows.
      
      Related #81722
      96b31f8e
    • Hendrik Liebau's avatar
      Improve error handling for `headers`/`cookies`/`draftMode` in `'use cache'` (#81716) · 4e0b1125
      Hendrik Liebau authored
      This ensures that we show a proper error with an error stack
      (potentially source-mapped) when accessing
      `headers`/`cookies`/`draftMode` in `'use cache'`, even when caught in
      user-land code. For `searchParams` (currently triggering a timeout
      error) we'll need a slightly different solution, which will be handled
      in a future PR.
      
      The approach chosen here is somewhat temporary, as we'd like to
      implement compile-time errors instead for accessing any kind of request
      data in `'use cache'` functions. However, this would require a larger
      change to our bundlers.
      
      closes NAR-201
      4e0b1125
    • Zack Tanner's avatar
      fix: pages router metadata bugs with React 19 (#81733) · 63090e20
      Zack Tanner authored
      When we updated `experimental.strictNextHead` to be true in #65418, we
      did not update all spots that would default to true in the case where
      the value was omitted entirely.
      
      This led to the default value not being correctly applied in pages
      router, which resulted in duplicate metadata w/ React 19.
      
      Since we made the flag the default, we can also probably clean up this
      flag all together, but that can be done separately.
      
      Fixes #81655
      Fixes #81689
      63090e20
    • Ben Gubler's avatar
      chore: update username from 'nebrelbug' to 'bgub' (#81734) · 2eac9dcc
      Ben Gubler authored
      ## Update GitHub username in labeler configuration
      
      I just changed my username from "nebrelbug" to "bgub"
      2eac9dcc