1. 23 Jun, 2026 16 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.63 · 0776ea2f
      next-js-bot[bot] authored
      0776ea2f
    • Hendrik Liebau's avatar
      Compute dev fallback params from the most-specific prerendered route (#95066) · e59eb73b
      Hendrik Liebau authored
      When Cache Components is enabled, the development server threads a
      `fallbackParams` request meta for dynamic app routes so the staged
      render knows which params are not statically known and must be deferred
      to a later stage. The previous computation walked the prerendered routes
      from `getStaticPaths` and kept the one with the fewest fallback params,
      without checking that the route actually matched the requested URL.
      Consider `/mixed/[lang]/[id]` where `generateStaticParams` covers `lang:
      'en'` but not `id`: the prerendered routes are the base
      `/mixed/[lang]/[id]`, which defers `[lang, id]`, and the covered
      `/mixed/en/[id]`, which defers only `[id]`. For the request
      `/mixed/fr/123` the fewest-fallback route is `/mixed/en/[id]`, but `en`
      does not match `fr`, so applying its `[id]` set left `lang` out of the
      fallback set and `fr` was treated as a statically known value.
      
      Because this meta decides which stage each param resolves in, and the
      stage decides the environment a replayed `console.log` is attributed to,
      treating `fr` as static resolved it in the prerender stage instead of
      deferring it to the runtime stage. The computation now matches the
      requested URL against each prerendered route with the canonical
      `getRouteRegex` and, among the routes that match, picks the
      most-specific one, the one with the fewest fallback params. For
      `/mixed/fr/123` only the base route matches, so its `[lang, id]` set is
      used and both params defer, while for `/mixed/en/123` the covered
      `/mixed/en/[id]` still matches and wins, so `lang` resolves statically
      and only `id` defers. This mirrors what a production build writes to the
      prerender manifest, where the server matches the URL to the
      most-specific prerendered route at request time. The change is
      development-only, gated on the route module being in dev mode, and
      production continues to read the manifest. A later change in this stack
      reads the same `fallbackParams` meta for the Instant Navigation testing
      API's on-demand shell render, so that path defers the identical per-URL
      set a production prefetch would.
      e59eb73b
    • Hendrik Liebau's avatar
      Release the instant navs lock without clearing the whole cookie jar (#94947) · 82cd9945
      Hendrik Liebau authored
      The `instant()` helper in `@next/playwright` released the navigation
      lock by calling `page.context().clearCookies({ name: INSTANT_COOKIE })`.
      Playwright implements a filtered `clearCookies` non-atomically: it
      clears the entire cookie jar and then re-adds the cookies that don't
      match the filter, briefly removing the application's own cookies too.
      Because Next.js reacts to the instant cookie's deletion by immediately
      re-rendering (a soft refresh or a full reload), a render whose request
      raced that empty window observed none of the test's cookies, so a page
      reading `cookies()` rendered as if nothing was set, for example
      `testCookie: not set`. Resource contention widened the clear-then-re-add
      window, which is why the instant navigation suite failed intermittently
      in CI.
      
      <img width="225" height="225" alt="empty cookie jar"
      src="https://github.com/user-attachments/assets/770b8817-e4c4-4b4b-8251-30353d892816"
      />
      
      We now release the lock by reading the instant cookie's stored entries
      (Next.js may have updated the value, e.g. from `[0]` to `[1, null]`, but
      preserves the domain and path) and re-adding each with a past expiry,
      which deletes only those entries and leaves every other cookie
      untouched. This removes the transient empty-jar window while still
      firing the CookieStore deletion event that releases the lock.
      
      To exercise the fix under the conditions that surfaced it, we want CI's
      flake-detection job to replay the instant navigation suite, which only
      happens when the suite's test file changes. We trigger that by
      un-skipping the `renders runtime-prefetched content instantly during
      navigation` test. That test had been skipped as flaky because of a real
      bug in the dev runtime-prefetch decode, which #94866 has since fixed, so
      it passes reliably now and no longer needs to be skipped.
      82cd9945
    • Joseph's avatar
      docs(caching): clarify generateStaticParams prebuild and recommend max for CMS (#95081) · 6df3f236
      Joseph authored
      The caching guide and ISR without CC, did not reference, nor mention,
      generateStaticParams.
      
      Additionally, we have learned that agents do use `max` for CMS content
      and such, but not as often as we'd like. The default cache life time,
      has a revalidate of 15 minutes, which for content that changes rarely,
      is too often. Note that `max` is defined as the life time for that case.
      
      We could do a further expansion that, the 30 days is enough because
      managed hosting likely evicts the generated asset after 30 days anyway,
      and that maybe self-host can use longer revalidate too, and that way
      have a discoverability path for defining a custom profile.
      6df3f236
    • Luke Sandberg's avatar
      Fix #95015 by pulling a fix to scattered-collect (#95098) · 1b1cf7b4
      Luke Sandberg authored
      Bump link-section to pick up
      https://github.com/mmastrac/linktime/pull/481
      
      This fixes a bug in linktime that could trigger a miscompilation on
      windows, see https://github.com/mmastrac/linktime/issues/479 for a
      detailed description
      
      @bgw and I both confirmed that this fixed the windows crash, though we
      have failed to produce a reproduction. This appears to not be triggering
      in CI due to a different release profile.
      1b1cf7b4
    • Hendrik Liebau's avatar
      Opt Partial Prefetching routes into the runtime stage of Cached Navs (#95097) · 824fcd63
      Hendrik Liebau authored
      In #95064 we added a global opt-in to the runtime stage of Cached
      Navigations: setting `cachedNavigations: 'allow-runtime'` makes every
      route runtime-cache, on top of the existing per-segment `prefetch =
      'allow-runtime'`. This extends the opt-in: a `prefetch` config of
      `'partial'`, `'unstable_eager'`, or `'allow-runtime'` all enable Partial
      Prefetching for a route, and a route already doing PPR-style partial
      prefetching should also runtime-cache its navigations. The next-config
      `partialPrefetching`, which enables Partial Prefetching globally, opts
      every route in as well.
      
      Both runtime-prefetch spawn gates in `app-render.tsx` now broaden their
      condition to include `partialPrefetching` and any segment `prefetch`
      that enables Partial Prefetching, via a new
      `anySegmentHasPartialPrefetchingEnabled` helper. The narrower callers
      that gate metadata staging and the dev reveal stage keep using
      `anySegmentHasRuntimePrefetchEnabled`, since they specifically concern
      routes the client runtime-prefetches (`'allow-runtime'`), not partial
      ones.
      
      Because `partialPrefetching` has no default and is not auto-enabled by
      `cacheComponents`, apps that do not set it are unaffected.
      
      Tests add `prefetch = 'partial'` and `prefetch = 'unstable_eager'`
      routes to the existing `default` fixture and a new `partial-prefetching`
      fixture for the global config, each asserting the route runtime-caches
      its request-derived content on a second navigation without a per-segment
      `prefetch = 'allow-runtime'` export.
      824fcd63
    • Benjamin Woodruff's avatar
    • Aurora Scharff's avatar
      skill(next-cache-components-adoption): clarify prereqs (#95082) · e2b013fc
      Aurora Scharff authored
      ### What
      
      Driven by three friction logs from agents running
      `next-cache-components-adoption` against starting points the skill
      silently assumed.
      
      - Restructure `## requires` as a labeled checklist: **App Router
      project**, **Next.js 16.3 or later**, **No incompatible config keys**.
      Each item names what's checked, what the failure mode is, and where to
      resolve it.
      - Hoist the **No green baseline before the flag** note out of the prereq
      pile into a separate `### notes` block (alongside **Offline docs**), so
      a reader scanning prereqs doesn't conflate it with a hard requirement.
      - Tighten the codemod block: explain `@canary`'s necessity in one line
      so an agent hitting `Invalid transform choice` from `@latest` knows the
      workaround.
      
      ### Why
      
      Three friction logs each hit a different version of the same gap:
      
      - **react.dev migration**: agent ran codemod with `@latest` (16.2.9) →
      `Invalid transform choice` → applied transform by hand.
      - **Marketing-site case**: agent built the spec with `revalidate`
      exports, codemod left them in, `cacheComponents: true` rejected the
      build.
      - **E-commerce case**: `experimental.dynamicIO`/`useCache` left in
      `next.config` → fatal config error.
      
      In each case the skill *technically* said what to do but it was buried.
      
      ### Related
      
      The migration-guide changes that were originally in this PR moved to
      [#94997](https://github.com/vercel/next.js/pull/94997).
      
      ### Type of Change
      
      - [x] Documentation (adds or changes documentation)
      
      <!-- NEXT_JS_LLM_PR -->
      e2b013fc
    • Sam Selikoff's avatar
      Navigation inspector UI updates (#94959) · 6ba8c3c1
      Sam Selikoff authored
      Updates the Navigation Inspector panel UI to match the new
      shell-inspection design.
      
      - Reworks the idle, waiting, static shell, and client shell states
      around the new “Pause on navigations” toggle
      - Adds full-width waiting/debugger banners, updated copy, URL labels,
      and the `Resume` action
      - Simplifies the panel expansion animation so only the panel
      opens/closes, without fading the inner content
      
      To try it out, run
      
      ```
      pnpm next dev test/development/app-dir/instant-navs-devtools
      ```
      
      
      https://github.com/user-attachments/assets/271d788e-87b9-4787-8d31-8008b9e693c0
      
      ---------
      Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      6ba8c3c1
    • Aurora Scharff's avatar
      Insights: drop irrelevant fix cards from instant errors (#94926) · f965c004
      Aurora Scharff authored
      ### Why?
      
      Two Insight fix cards were misleading:
      
      1. **`generateStaticParams` showed up on every runtime/client-hook
      insight.** One error covers `cookies()` / `headers()` / `params` /
      `searchParams`. GSP only applies to `params`; for the others it's noise.
      Even for `params` it nudges devs to make the route static instead of
      fixing the immediate error.
      2. **`"use cache"` showed up on `connection()` triggers.** Caching
      `connection()` is contradictory.
      
      Both manifest on initial load and in-navigation (the fix-card sets are
      shared).
      
      ### What?
      
      1. **Drop the GSP card** from runtime + client-hook sets. Affects
      [01-cookies-body](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/01-cookies-body),
      [03-params-body](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/03-params-body),
      [90-client-use-params](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/90-client-use-params),
      [41-subnav-cookies](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/41-subnav-cookies),
      [42-subnav-fetch](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/42-subnav-fetch).
      2. **Filter `"use cache"`** when the cause is `connection()`. Affects
      [05-connection-body](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/05-connection-body),
      [08-connection-body-dynamic](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/08-connection-body-dynamic),
      [31-connection-in-metadata](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/31-connection-in-metadata),
      [33-connection-in-viewport](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/33-connection-in-viewport).
      [06-uncached-fetch-body](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/06-uncached-fetch-body)
      keeps the Cache card.
      
      ### How?
      
      - `getCards()` filters the cache card when `cause === 'connection'`.
      - New `deriveCauseFromCodeFrame()` helper detects `connection(` on the
      highlighted code-frame line.
      - `ParamClientHookDynamicError` collapsed into `ClientHookDynamicError`.
      - CLI/build messages: dropped the GSP bullet; added `(does not apply to
      \`connection()\`)` on the cache bullet.
      - Docs: removed `For known params, prerender` sections; added a
      connection caveat on dynamic/metadata-dynamic/viewport-dynamic pages.
      
      <!-- NEXT_JS_LLM_PR -->
      f965c004
    • Andrew Clark's avatar
      Serve ISR fallback shells in response to prefetch requests (#94534) · 70407f12
      Andrew Clark authored
      Previously, a static segment prefetch that hit a route with an
      unresolved ISR entry could not be served a fallback shell, so the
      prefetch cache was left cold until the entry regenerated. This enables
      prefetch requests to be served the ISR fallback shell immediately, so
      the prefetch cache can be warmed right away instead of waiting.
      
      Because the shell is only a partial response, the client retries the
      prefetch a bounded number of times so it eventually warms the cache with
      the full (concrete) response once the server finishes regenerating in
      the background. Only shells that can actually be upgraded are retried —
      a route with no generateStaticParams never upgrades, so its shell isn't
      flagged and the client doesn't waste retries on it.
      
      The new serving behavior is gated behind the experimental `appShells`
      flag, so existing behavior is unchanged when it's off.
      
      <!-- NEXT_JS_LLM_PR -->
      70407f12
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.62 · 8b53fd61
      next-js-bot[bot] authored
      8b53fd61
    • Aurora Scharff's avatar
      docs: add Interactive Apps guide (#94020) · ff43248f
      Aurora Scharff authored
      ### What?
      
      Adds the Interactive Apps guide
      (`docs/01-app/02-guides/interactive-apps.mdx`) with a companion
      [Taskboard app](https://github.com/vercel-labs/async-react-demo).
      
      ### Why?
      
      There is no end-to-end guide that shows how to coordinate pending work
      across Server Functions, transitions, optimistic UI, and caching in a
      single app.
      
      ### How?
      
      The guide walks through building a task management board in 8 steps,
      from a plain Server Component app to one with optimistic UI, streaming,
      caching, and prefetching:
      
      1. Stream slow data with Suspense — promise-passing to split reads into
      independent boundaries
      2. Respond instantly to a toggle — `useOptimistic` + `startTransition`
      for a priority cycle
      3. Filter with pending feedback — `useTransition` + `data-pending` for
      label chips, action props for `ChipGroup`
      4. Add comments with instant feedback — `useOptimistic([])` for a
      pending-only comment list
      5. Move cards between columns — optimistic reducer for drag-and-drop
      status updates
      6. Manage form lifecycle with useActionState — `isPending`, key-based
      reset, double-transition for dialog close
      7. Signal pending deletion to a parent — `useOptimistic(false)` +
      `data-pending` CSS attribute
      8. Make repeat navigation instant — `use cache`, `cacheTag`,
      `updateTag`, `unstable_prefetch`
      
      The companion app lives at
      [vercel-labs/async-react-demo](https://github.com/vercel-labs/async-react-demo).
      The `plain` branch is the starting point, `main` has all 8 steps
      applied.
      
      ---------
      Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
      ff43248f
    • Sebastian "Sebbie" Silbermann's avatar
    • Benjamin Woodruff's avatar
      Turbopack: Avoid clone when sorting by module file path (#95079) · 4638ab18
      Benjamin Woodruff authored
      Minor nit: In the worst-case (module id can be an `RcStr` or a u64),
      this eliminates two `RcStr` clones+drops per iteration of the sort
      algorithm.
      
      The code is cleaner with `sort_by_key`, but `sort_by_key` introduces an
      artificial lifetime issue that `sort_by` avoids.
      
      This is a long-standing and widely documented language issue:
      https://github.com/rust-lang/rust/issues/34162
      4638ab18
    • Benjamin Woodruff's avatar
      c06894ae
  2. 22 Jun, 2026 17 commits
    • Jude Gao's avatar
      [skills] Mark insight-error-page and next-rspack as internal (#95070) · c505af99
      Jude Gao authored
      These two maintainer skills live under `.agents/skills/` alongside the
      internal dev skills (`flags`, `create-pr`, `react-vendoring`, etc.), all
      of which carry `metadata.internal: true`. They were missing the flag, so
      the skill sync pulled them into the external/universal distribution.
      Adds `metadata.internal: true` to both, matching their siblings.
      
      <!-- NEXT_JS_LLM_PR -->
      c505af99
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.61 · 82a33195
      next-js-bot[bot] authored
      82a33195
    • Aurora Scharff's avatar
      skill(next-cache-components-adoption): tune skill to mention app router requirement (#95069) · 9e344c92
      Aurora Scharff authored
      ### What
      
      Two small edits in
      [`skills/next-cache-components-adoption/SKILL.md`](https://github.com/vercel/next.js/blob/canary/skills/next-cache-components-adoption/SKILL.md):
      
      1. Add **App Router only** bail-out above the **Next.js 16.3+** version
      note in the `## requires` section. The Pages-Router check is the hard
      bail-out for this skill, so it should run before the version-upgrade
      guidance.
      2. Remove an accidentally duplicated "End of every milestone: summarize
      and ask" paragraph in `## the shape of the work`.
      
      ### Why
      
      From a friction log of an agent driving this skill against a Pages
      Router project: the agent read past the version note, started the
      upgrade, and only hit the App Router incompatibility several steps in.
      Surfacing the bail-out first saves that round trip.
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarCopilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
      9e344c92
    • Sam Poder's avatar
      [turbopack] Sort modules in files by path not ID (#95065) · e169a26f
      Sam Poder authored
      Sorting-by-ID was flagged as bad for g-zipping:
      
      > This sorts by chunk item id.
      > Tobias has been saying that this is bad, because it gzips worse
      > We should be sort by path, so that similar modules stay together. E.g.
      if you have many similar icon modules
      > Sorting by chunk item results in random order
      
      Switched to sorting by path!
      e169a26f
    • Sam Poder's avatar
      [turbopack] Rename the edge runtime to the self-contained runtime (#94726) · ae7ab812
      Sam Poder authored
      This isn't really a functionality change but it makes later PRs up the
      stack make more sense. At this point though it's just a name change.
      ae7ab812
    • Hendrik Liebau's avatar
      Add a global opt-in for the runtime stage of Cached Navigations (#95064) · e383590a
      Hendrik Liebau authored
      `cachedNavigations` is an under-the-hood optimization that caches
      subsets of a route, seeded from actual navigations, so subsequent
      navigations to the same or similar page are served instantly. It is on
      by default with Cache Components. The static stage is automatic, while
      the more expensive runtime stage (which spawns an additional prerender
      and embeds its output in the response) is opted into per segment via
      `export const prefetch = 'allow-runtime'`.
      
      Gating the runtime stage on the `prefetch` config is awkward, because
      Cached Navigations is about caching real navigations rather than
      speculative prefetching, so the people who benefit most are exactly
      those who turn prefetching down. To dogfood the runtime stage's CPU and
      payload overhead across a whole app, this change widens the
      `experimental.cachedNavigations` config from `boolean` to `boolean |
      'allow-runtime'`. `true` keeps its current meaning, and
      `'allow-runtime'` additionally treats every route as runtime-cached
      regardless of its per-segment `prefetch` config.
      
      The new value only affects the two production spawn gates in
      `app-render.tsx` (the client-navigation Flight render and the initial
      HTML render), where the runtime prerender is now spawned when either a
      segment opted in or the global flag is set. Prefetch hints, instant
      validation, and component-tree staging are intentionally left keyed off
      the per-segment config. The widened value is preserved through the
      render options (the build templates pass it through instead of coercing
      it to a boolean), while the client-facing env var stays a plain boolean
      since the runtime prerender is entirely server-driven.
      
      The `cached-navigations` e2e fixture is split into a `default/` fixture
      (the existing suite, re-pointed) and a new `global-runtime/` fixture
      that sets `cachedNavigations: 'allow-runtime'`, with a test asserting
      that a route with no `prefetch` export still has its request-derived
      content runtime-cached on a second navigation.
      e383590a
    • Aurora Scharff's avatar
      skill(next-dev-loop): fix --session flag, agent-browser bootstrap, --headed daemon note (#95005) · 88ef2160
      Aurora Scharff authored
      Three small `next-dev-loop` skill fixes from a real adoption run.
      
      **1. Flag mismatch.** Preflight documented `--session-name <slug>` but
      the CLI flag is `--session <name>`. The skill tells agents to trust the
      documented command over source, so the copy-paste failed. Fixed in two
      places (preflight + post-loop close).
      
      **2. `agent-browser` bootstrap.** The CLI isn't always installed; the
      skill said "upgrade" but not "install if missing." Reworded the prereq
      bullet to *"Install or upgrade `agent-browser`"* and added a line
      telling the agent to install it before continuing if it isn't on `PATH`.
      
      **3. `--headed` daemon gotcha.** Launch flags like `--headed` are
      silently ignored when the `agent-browser` daemon is already running from
      a previous session (`⚠ --headed ignored: daemon already running`). The
      preflight just listed `--headed` without noting this, so a second
      session inherited the first one's flags. Added a callout telling the
      agent to run `agent-browser close` first to change launch flags.
      
      Docs-only.
      
      <!-- NEXT_JS_LLM_PR -->
      88ef2160
    • Sebastian "Sebbie" Silbermann's avatar
      e7f4e336
    • Aurora Scharff's avatar
      codemod: cache-components-instant-false + next-cache-components-adoption skill (#94941) · ae62a6f7
      Aurora Scharff authored
      ### Why?
      
      Turning on `cacheComponents` makes every blocking route a build error at
      once. On a large app that's a wall of failures with no clear order to
      fix them in, which is a rough first experience.
      
      ### What?
      
      An opt-in adoption path so enabling Cache Components doesn't have to be
      all-or-nothing:
      
      - **`cache-components-instant-false` codemod** (`@next/codemod`) —
      blanket-inserts `export const instant = false` (with a `// TODO: Cache
      Components adoption` comment) into every `app/**/{page,layout}` file, so
      the build goes green immediately. Idempotent: skips files that already
      export `instant` (including aliased `export { x as instant }`). Skips
      Client Components (`"use client"`) and route handlers.
      - **`next-cache-components-adoption` skill** (`skills/`) — sequences the
      full migration in five steps across four milestones: green build
      (codemod or direct), remove the opt-outs top-down one group at a time,
      make navigations instant via the dev-overlay Insights, then adopt
      Partial Prefetching. It defers individual fixes to the dev overlay fix
      cards, stack traces, and the `/docs/messages/blocking-prerender-*`
      pages, and points at the migration / instant-navigation / Partial
      Prefetching guides rather than re-teaching them. Verifies each change at
      runtime via `next-dev-loop` (with a manual dev-overlay fallback). The
      `next-cache-components-optimizer` skill is referenced only as optional
      shell-growing polish after adoption is complete.
      
      ### How?
      
      - Transform registered in `TRANSFORMER_INQUIRER_CHOICES` at `version:
      '16.3.0'`.
      - 8 fixtures cover insert-into-page / -layout, JSDoc placement, and
      no-op on existing / aliased / multi-declarator / local-binding `instant`
      and on `"use client"` pages. `pnpm jest cache-components-instant-false`
      passes.
      - Docs: a `cache-components-instant-false` entry in the codemods
      reference, and a pointer to the skill + codemod from the migration
      guide.
      ae62a6f7
    • Vercel Release Bot's avatar
    • Hendrik Liebau's avatar
      Statically prerender metadata image routes under Cache Components (#94957) · 89c67992
      Hendrik Liebau authored
      Under Cache Components, metadata image routes such as `opengraph-image`
      and `icon` that return an `ImageResponse` were always rendered on demand
      (`ƒ`) rather than prerendered. `ImageResponse` defers rasterizing its
      element tree into the response body stream, and the route-handler
      prerender unwraps that body within a single task; the rasterization
      never finishes within that budget, so the route was classified as
      dynamic. This change renders and caches the image during the prerender
      so these routes become static (`○`).
      
      During the prerender we serialize the `ImageResponse` arguments with
      React Flight's `prerenderToNodeStream` inside the prerender work-unit
      store, which runs the user's component tree once in the correct scope.
      This brings any user-space I/O inside that tree, such as `cookies()` or
      an uncached `fetch`, under the same Cache Components rules that already
      governed I/O elsewhere in the handler. The hanging-input abort signal
      bounds the serialization and decides static versus dynamic: if the tree
      is still waiting on dynamic input once the prerender's cache-sourced
      input is ready, the serialization can't complete and we return a hanging
      promise, so the final prerender's macrotask budget classifies the route
      as dynamic; a tree that resolves entirely from static data or `use
      cache` finishes serializing and is rendered to an image. This mirrors
      `encryptActionBoundArgs`, which serializes server action bound args with
      React Flight under the same hanging-input abort signal during a
      prerender.
      
      The fully resolved element tree is then handed to satori. Because React
      Flight encodes an async Server Component's output as a `React.lazy` that
      satori can't walk, those references are resolved into plain elements
      first; this lets an async server component, including one that uses `use
      cache`, be passed as the `ImageResponse` element. Rasterization runs
      outside the prerender work-unit store: inside a Cache Components
      prerender an uncached `fetch`, such as the renderer loading a font, is
      turned into a hanging promise (Cache Components skips I/O that would not
      be cached anyway), so running satori with no store lets those framework
      fetches resolve normally. Crucially, because satori only walks the
      already-resolved tree, no user component runs in that storeless scope,
      so uncached user-space I/O can't be wrongly allowed there and let a
      route that should be dynamic render as static.
      
      The rendered image is stored as an `ArrayBuffer` in a new in-memory
      `imageResponses` store on the Resume Data Cache, keyed by a base64
      encoding of its serialized arguments, and the cache signal is held open
      until it is stored so the prospective prerender waits for it. The final
      prerender retrieves the array buffer from memory within microtasks. The
      store is in-memory only and is never serialized, so the image array
      buffers never enter the resume data that ships with the prerender.
      
      The caching path lives in a separate `cache-image-response` module that
      is loaded only for Cache Components builds, gated behind
      `process.env.__NEXT_CACHE_COMPONENTS` so the `require` and its React
      Flight dependencies are eliminated as dead code otherwise; apps without
      Cache Components keep `ImageResponse`'s original streaming behavior
      unchanged.
      
      ---------
      Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
      89c67992
    • Aurora Scharff's avatar
      docs(authentication): add Auth and streaming, fix code fences and imports (#95056) · db565337
      Aurora Scharff authored
      ### What?
      
      - New **Auth and streaming** subsection under `### Layouts and auth
      checks` explaining how a top-level `await` in a layout delays the first
      streamed chunk, and how to push the access into a nested `<Suspense>`
      boundary. Links to [Push dynamic access
      down](/docs/app/guides/streaming#push-dynamic-access-down) and to
      [Sharing data with context and
      `React.cache`](/docs/app/getting-started/fetching-data#sharing-data-with-context-and-reactcache).
      - Tightens the surrounding DAL paragraph (anchor link, "prevents
      developers from forgetting").
      - Fixes a few small bugs in surrounding code samples: default `cookies`
      imports (twice), `app/layout.ts` for a file with JSX, and two malformed
      code-fence directives in the Profile examples.
      
      <!-- NEXT_JS_LLM_PR -->
      db565337
    • Sebastian "Sebbie" Silbermann's avatar
    • Joseph's avatar
      0ef205e7
    • Niklas Mischkulnig's avatar
      [otel] Correctly set error code attributes for App API routes (#94979) · f66c8a6a
      Niklas Mischkulnig authored
      **View diff without whitespace**
      
      When using adapters, throwing a JS error from a App Route Handler didn't
      set the OTEL status code correctly.
      It was doing this:
      ```js
      try {
      	tracer.trace(() => {
      		try {
      			// handle...
      		} finally {
      			setOtel();
      		}
      	});
      } catch(e){
      	send500();
      }
      ```
      Which I now changed to
      ```js
      	tracer.trace(() => {
      		try {
      			// handle...
      		} catch(e){
      			send500();
      		} finally {
      			setOtel();
      		}
      	});
      
      ```
      f66c8a6a
    • Hojeong Park's avatar
      docs: fix typo in slot-missing-default.mdx (#94531) · 64429129
      Hojeong Park authored
      Fixed a typo in `errors/slot-missing-default.mdx`:
      
      - `Optiona` → `Optional`
      
      <!-- 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
      
      ### 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 #
      
      -->
      64429129
    • Niklas Mischkulnig's avatar
      [test] Fix failing determinism test using adapter (#95051) · bbd0abe8
      Niklas Mischkulnig authored
      https://github.com/nextjs/adapter-vercel/pull/70 broke the test
      
      Instead, read the test-only `__NEXT_SUPPORTS_IMMUTABLE_ASSETS` after
      modifyConfig.
      bbd0abe8
  3. 20 Jun, 2026 2 commits
  4. 19 Jun, 2026 5 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.59 · b216be9c
      next-js-bot[bot] authored
      b216be9c
    • Janka Uryga's avatar
      fix: request APIs in promises passed to after() in actions/handlers (#94964) · 7fc1a200
      Janka Uryga authored
      Fixes a bug where Route Handlers and Server Actions were prevented from
      calling `headers()` (and other request APIs) if
      - the call happened after the response is finished
      - the call *did not happen* inside an after-callback
      generally, this happens when you pass a promise to after.
      ```ts
      const longRunning = () => {
        // assume this resolves after the response
        await new Promise((resolve) => setTimeout(resolve, 100))
        // response is done
        after(() => {
          await headers() // ❌ should be allowed, but throws
        })
      }
      
      after(longRunning()) // or waitUntil, doesn't matter
      ```
      
      The logic we used in the check was incorrect and assumed that an
      `afterTaskStore` was present, but we can only wrap callbacks in this ALS
      - we cannot change the async context of already-running promises.
      
      One noteworthy change is that i had to exit `actionAsyncStorage` when we
      do a render after the server action. Otherwise the checks in
      `isRequestApiAllowedInCurrentPhase` might believe that they're still in
      a server action when they aren't.
      7fc1a200
    • Janka Uryga's avatar
      fix: after(callback) called after response end (#94974) · d538cfb7
      Janka Uryga authored
      Fixes a bug where if `after(callback)`was called after the response
      ended, and no `after(callback)` calls occurred earlier, the callback
      would never run.
      
      Implementation-wise, what happens is:
      1. when the first callback is scheduled, we do `runCallbacksOnClose()`,
      which waits until `onClose` fires and starts the callback queue
      2. but if no `after(callback)` calls occurred before the response ended,
      then by the time we got to `runCallbacksOnClose()`, `onClose` has
      already fired, so we'd wait forever
      
      We now start listening for `onClose` when the context is initialized and
      track the state (`isRequestClosed`), which avoids this.
      
      I also did another drive-by fix here: if we only had `after(promise)`
      calls, we wouldn't switch the workUnitStore's phase to `'after'`,
      because we were only doing that in the `after(callback)` codepath. This
      is relevant in #94964 which fixes some bugs around `after(promise)`.
      d538cfb7
    • Jimmy Lai's avatar
      router instrumentation: add transition start context (2/7) (#94766) · 34759c3e
      Jimmy Lai authored
      ## Stack Position
      
      (2/7) in the router instrumentation stack.
      
      1. #94755: router instrumentation: refactor client hook dispatch (1/7)
      2. **#94766: router instrumentation: add transition start context
      (2/7)**
      3. #94756: router instrumentation: add transition commit events (3/7)
      4. #94765: router instrumentation: add commit route and prefetch context
      (4/7)
      5. #94757: router instrumentation: add transition abort events (5/7)
      6. #94758: router instrumentation: add route mismatch events (6/7)
      7. #94737: router instrumentation: add transition settlement events
      (7/7)
      
      Parent: #94755
      Next: #94756
      
      ## What This PR Does
      
      Adds an experimental third argument to the existing start hook:
      
      ```ts
      export function onRouterTransitionStart(url, navigationType, event) {}
      ```
      
      The event contains:
      
      - `id` and framework-captured Unix `timestamp` in milliseconds
      - `fromRoutes`: route patterns visible when navigation is dispatched
      - `prefetchIntent`: `full`, `auto`, or `none`
      
      The primary `children` route is first, followed by visible parallel
      slots in deterministic order.
      
      ## Design
      
      Start owns the context that is authoritative before navigation work
      begins: the screen being left and the caller's prefetch intent.
      Destination routes and the cache result actually used are reported by
      commit instead. Consumers correlate them by transition ID.
      
      Without `experimental.instrumentationClientRouterTransitionEvents`, the
      existing two-argument hook behavior is unchanged.
      
      ## Not In This PR
      
      - Destination routes or observed prefetch result
      - Commit, abort, mismatch, or settled hooks
      
      ## Reviewer Focus
      
      - Route pattern extraction, including dynamic and parallel routes
      - Primary route ordering
      - Link intent propagation and experimental gating
      
      ## Validation
      
      - `pnpm build-all`
      - `pnpm --filter=next build`
      - App Router instrumentation client E2E: 15/15
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarJude Gao <jude.gao@vercel.com>
      34759c3e
    • Will Binns-Smith's avatar
      typegen: default to Turbopack (#94952) · 47d4abc1
      Will Binns-Smith authored
      While the bundler isn't super relevant for typegen, we _do_ validate the
      config as part of the process, so some checks (like those added with the
      experimental rust react compiler) can fail if we're not consistent about
      the default.
      
      Test Plan: added an e2e test to verify the config is validated as
      turbopack by default
      47d4abc1