fix(deps): update dependency react-router to v8 [security] #7

Open
renovate-bot wants to merge 1 commit from renovate/npm-react-router-vulnerability into main
Member

This PR contains the following updates:

Package Change Age Confidence
react-router (source) ^6.30.6 → ^8.0.0 age confidence

React Router: Arbitrary Constructor Injection via deserializeErrors() in React Router SSR Hydration

CVE-2026-53666 / GHSA-337j-9hxr-rhxg

More information

Details

If application code allows attacker supplied input to overwrite certain aspects of errors caught by the SSR process, then it was possible for attacker to trigger unexpected constructor execution on the client which would trigger outbound network traffic. This is only possible with very specific (and unlikely) application layer code.

Note

This does not impact your application if you are using Declarative Mode. This only impacts Framework Mode and Data Mode applications doing manual SSR/hydration

Severity

  • CVSS Score: 6.1 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


CVE-2026-53669 / GHSA-wrjc-x8rr-h8h6

More information

Details

This is a follow up to CVE-2025-68470. React Router was alerted to certain scenarios in which the fix there was incomplete so there still existed some scenarios where attacker supplied paths passed to navigation mechanisms could result in unexpected external navigations.

Severity

  • CVSS Score: 5.1 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Release Notes

remix-run/react-router (react-router)

v8.5.2

Compare Source

Patch Changes
  • Keep navigation metadata consistent after a submission action throws an error (#​15621)
    • Use the committed history action for loader dataStrategy navigation types and loading navigation history actions
  • Cancel the discarded response body for HEAD requests, so a resource route streaming a file no longer leaks its file descriptor (#​15634)
    • Keep observing nested deferred promise rejections after cancelling a data response so they cannot crash the server
  • Preserve streamed <Suspense> boundaries during hydration in development (#​15382)
    • Wrap the critical CSS reset in React.startTransition to prevent React 19 from silently discarding the server HTML and rendering the boundary on the client
  • Fix submissions to root form actions containing search parameters or a hash when a basename is configured (#​15725)
  • Fix href() to throw for null required parameters and omit null splat parameters without a trailing slash, matching the behavior for undefined and the defined types (#​15754)
  • Fix generated MetaArgs.matches types to stop at the current route instead of appending an unknown, possibly undefined tail (#​15697)
  • Improve path generation and URL validation across href(), generatePath(), links, forms, fetchers, and redirects (#​15785)
  • Stop redirect(), redirectDocument() and replace() from setting status: 302 on the ResponseInit passed to them (#​15753)
    • Later responses created from the same init object no longer get status 302, and a frozen init no longer throws
  • Clear an <Await> render error when it receives a new resolve value, so the error element no longer stays on screen after navigating to a route whose data renders fine (#​15695)
  • Run clientMiddleware during RSC client navigations and preserve it when route components update via HMR (#​15763)
  • Handle HEAD resource responses consistently in RSC Framework and RSC Data modes (#​15783)
  • Fix initial rendering of RSC routes with a clientLoader and no HydrateFallback (#​15763)
  • Fix <ScrollRestoration> throwing an uncaught error before hydration when sessionStorage is unavailable (#​15566)
    • The inline restore script already logged the storage error, but its cleanup call accessed sessionStorage again and threw (e.g. Chrome with "Block all cookies", sandboxed cross-origin iframes)
    • The error is still logged with console.error; only the second, uncaught throw is removed
  • Fix useBlocker leaving behind a stale blocker that keeps blocking navigation after its component is hidden and shown again with <Activity>, or after the router is recreated (#​15710)

v8.5.1

Compare Source

Patch Changes
  • Fix URIError: URI malformed when an ssr: false dev server receives a URL path with a malformed percent-encoding (#​15649)
  • Bound server route manifest processing for paths with expensive route expansion (#​15703)
    • Fall back to initial route discovery during server rendering and RSC document/data requests
    • Account for the number and depth of candidate branches when using regex matching
  • Encode commas within paths sent to the lazy route discovery manifest endpoint so routes with commas in their paths are discovered correctly (#​15640)
  • Fix fetcher revalidation errors bubbling to the root error boundary instead of the nearest boundary above the route that owns the fetcher (#​15676)
  • Avoid duplicate history entries when posting a <Form> to the current URL with an encoded action (#​15679)
    • Replace the current history entry when the action contains characters that get percent-encoded, such as spaces or non-ASCII characters
  • Fix an unhandled promise rejection when the browser skips a viewTransition navigation, for example in a hidden tab (#​15582)
  • Bubble rejected lazy.Component imports on loader-less routes to the nearest error boundary (#​15658)
    • Render the error boundary instead of a blank page
  • Preserve pending fetcher mutation revalidation when an older navigation or background reload completes to prevent stale loader data (#​15686)
    • Keep newer fetcher loads cancellable and preserve them when earlier revalidations finish or abort, preventing older responses from overwriting fresh fetcher data
  • Retry rejected lazy route imports instead of caching failures permanently (#​15689)
  • Revalidate loader data when a fetcher action redirect is not followed (#​15557)
    • Revalidate when an action redirect is ignored because a newer navigation started or the fetcher unmounted while the action was running
    • Include shared parent loaders when another navigation completed while the action was running
    • Continue to respect shouldRevalidate
    • Return fetchers to idle when a revalidation completes a pending navigation started by another fetcher's redirect
  • Avoid adding an incompatible document.startViewTransition() overload to the global Document type (#​15680)
    • Allow transition results to be assigned to the DOM ViewTransition type
  • Skip deleteData in destroySession when the session has no ID (#​15639)
    • Avoid failures when destroying a session without a cookie on storage that rejects an empty key
  • Surface the host's 404 response when a SPA fallback route has no prerendered data (#​15646)
    • Request single-fetch .data files for hydrating routes with a server loader in an ssr: false app with a prerender config
    • Avoid the internal "No result found for routeId" error for non-prerendered parameterized paths served via the SPA fallback
  • Improve turbo-stream decoding validation and object property handling (18e1fbd)
Unstable Changes

⚠️ Unstable features are not recommended for production use

  • Add an opt-in <Await unstable_promise={promise}> implementation based on React's use() API (#​15678)
    • Use React.use instead of React Router's internal promise tracking
    • Accept promise-like values and retain errorElement, useAsyncValue, and useAsyncError support
    • Handle only promise rejections with errorElement when using unstable_promise, allowing child render errors to bubble to the nearest React error boundary
    • Track streamed promises during decoding so settled server content stays visible during hydration updates with either Await API or direct React.use()
  • Fix URIError: URI malformed when an API-only (ssr: "unstable_api-only") server receives a URL path with a malformed percent-encoding (#​15649)
  • Fix duplicate headers when throwing a redirect from an RSC server function (#​15667)

v8.5.0

Compare Source

Minor Changes
  • Deprecate React Router's view transition APIs in favor of React's <ViewTransition> component, available in React 19.3 and later (#​15493)
    • Deprecate the viewTransition props/options, useViewTransitionState, and NavLink's isTransitioning render prop and transitioning class
    • Preserve existing behavior, including support for older React versions
    • See the migration guide for a navigation example and compatibility considerations
Patch Changes
  • Fix <Await> failing to server render promises decoded from an RSC payload, which caused the Suspense boundary to switch to client rendering (#​15597)
  • Declare @types/react and @types/react-dom as optional peer dependencies so the shipped type definitions resolve React types under strict (non-hoisted) node_modules layouts (#​15528)
  • Fix the unstable_useRouterState documentation example to call the imported alias (#​15535)
  • Render the HydrateFallback of a route discovered through patchRoutesOnNavigation during initial hydration (#​15537)
    • Routes discovered during initial hydration are now exposed in state.matches while their loaders run, so <RouterProvider> renders down to the discovered route's HydrateFallback instead of rendering nothing
  • Fix router state recovery when updates occur before RouterProvider subscribes, including when other subscribers are already attached, and report current client errors once without replaying server errors during hydration (#​15637)
  • Fix matchPath not treating a static segment as optional when it contains characters outside [\w-] (#​15425)
  • Fix an RSC server crash when a client aborts a document request while the HTML stream waits for the RSC payload (#​15612)
  • Stop revalidating a fetcher after fetcher.reset(), so its cleared data no longer comes back on the next revalidation (#​15633)
Unstable Changes

⚠️ Unstable features are not recommended for production use

  • Add an unstable_fetch prop to <HydratedRouter> to customize JavaScript-issued manifest and server data requests in conventional Framework Mode (#​15586)
    • The function receives the intended request as well as context identifying the type of request
    • Data request context includes navigationType ("PUSH", "REPLACE", or "POP" for navigation-initiated requests, including reloaded fetchers; null otherwise)
      • Data strategies receive equivalent metadata through unstable_initiator and unstable_navigationType
    • The custom fetch context is a discriminated union, so narrowing type to "navigation" guarantees a non-null navigationType, while other data requests have a null navigationType
      • Fetchers reloaded after an initialization redirect retain the "initialization" type and include their fetcher key
    • Like other router initialization options, the implementation is captured when the singleton router is created and thus subsequent prop changes are ignored
    • Browser-managed data prefetches from <Link prefetch> use native <link rel="prefetch"> elements and do not call the custom implementation
    • Use the callback for custom fetch options, custom headers, safe request retries, or response header inspection
    • Return response bodies unchanged so React Router can decode its manifest and Turbo Stream data protocols
  • Support API-only Framework Mode with runtime server data loading, actions, revalidation, and lazy route discovery (#​15601)
    • Hydrate prerendered pages from build-time data and fetch server loader data when hydrating a SPA fallback
    • Preserve normal loader revalidation and server-action support for eagerly loaded and lazily discovered routes, and honor loader opt-outs when making server data requests
  • Add unstable_useRouteDiscovery for application-controlled route discovery in conventional Framework Mode (#​15602)
    • Discover selected destinations or load the running client's full route manifest without loading route modules
    • Compose manifest-mismatch handlers, with shared recovery and cancellation that preserves application state
    • Keep full-manifest failures catchable without rendering error boundaries, whether mismatch handlers use the hook or event's loadAllRoutes()
    • Cancel pending revalidation alongside a canceled navigation, retaining existing data and settling interrupted fetchers before restoring Back/Forward history
    • Enable future.unstable_customRouteDiscovery to opt in
      • Apps without the flag retain existing discovery behavior
    • Call event.defaultBehavior() from a custom mismatch handler to explicitly run built-in recovery
  • Return middleware short-circuit responses as-is for document requests in RSC modes, including resource routes, instead of decoding non-RSC bodies as Flight (#​15628)
    • Include server middleware in both eager and lazy RSC route configuration types
    • Preserve HTML rendering for cached Flight responses returned by middleware, and pass through raw responses that replace the result of next()

v8.4.0

Compare Source

Minor Changes
  • Deprecate the createStaticRouter({ branches }) option (#​15297)
    • createStaticRouter now caches route branches internally, ignores branches, and logs a deprecation warning when the option is provided
    • The deprecated EntryContext.branches property remains available for compatibility but is always an empty array
Patch Changes
  • Prevent stale route discovery during manifest version-mismatch recovery (#​15489)
    • Keep concurrent manifest responses pending while a document reload is in progress
    • Report a discovery error when a previous reload failed to resolve a version mismatch instead of loading a stale route or reloading repeatedly
    • Fail pending requests if a document reload does not complete within five seconds or the document is restored from the back-forward cache, allowing subsequent requests to recover
  • Preserve lazy route module import errors during SPA navigations instead of replacing them with a missing dataStrategy result error (#​15464)
  • Switch to more granular internal router contexts to avoid unnecessary route component re-renders when unrelated data router state changes (#​15376)
    • ⚠️ This contains some breaking changes to exported UNSAFE_ contexts, so please review carefully if you are using those unsafe exports
  • Correctly escape streamed RSC redirect locations in meta tag attributes (#​15491)
  • Avoid unintended document.startViewTransition calls during initial hydration and router.revalidate() calls (#​15484)
  • Fix SingleFetchNoResultError thrown when a fetcher revalidates against a splat route during lazy route discovery (#​15395)
    • Track discovery per fetcher load so revalidation waits for the current load's discovery, even when the fetcher key is reused, while still restarting interrupted loaders after discovery completes
  • Preserve the underlying decode failure as the cause of the Unable to decode turbo-stream response error (#​15450)
Unstable Changes

⚠️ Unstable features are not recommended for production use

  • Add a Data Mode future.unstable_routePatternMatching flag for more efficient route matching powered by @remix-run/route-pattern (#​15298)
    • Add an unstable_validateParams route field to reject invalid parameter values and continue matching
  • Document access control requirements for RSC Server Functions (#​15490)
    • Treat every Server Function as a public endpoint that must perform all of its own access control checks
    • Recommend route actions when access control should be provided by route middleware

v8.3.1

Compare Source

Patch Changes
  • Fix Expected fetcher: <key> error thrown on navigation when a fetcher is aborted during its post-action revalidation (#​15365)
  • Fix lazy route discovery caching a path as discovered when the triggering navigation was aborted after the manifest response settled but before the route tree was patched, which permanently (for the session) shadowed the real route behind a catch-all or produced 404s on every subsequent visit (#​15399)
  • Improve route matching performance for long paths (#​15417)
  • Improve validation of action request origins (#​15419)
  • Fix <ScrollRestoration> leaving history.scrollRestoration set to "auto" after a bfcache restore, which let the browser restore scroll on subsequent history traversals before the destination route had rendered (#​15397)
  • Properly respect the relative option in useSubmit/fetcher.submit when resolivng the action path (#​15400)
  • Add additional URL validation on client side navigations/redirects (#​15445)

v8.3.0

Compare Source

Patch Changes
  • Encode path params in href/generatePath per RFC 3986 path-segment rules instead of encodeURIComponent (#​15310)
    • Characters that are valid literally in a path segment ($ & + , ; = : @ — RFC 3986 pchar) are no longer percent-encoded, so values like a semver build 1.0.0+1 interpolate unchanged instead of becoming 1.0.0%2B1
    • Structural/unsafe characters (/ ? # %, whitespace, non-ASCII) are still escaped exactly as before
  • Use crypto.randomUUID() for createMemorySessionStorage session ids (#​15302)
    • createMemorySessionStorage is only intended for local development and testing - sessions are lost when the server restarts
  • Fix NavLink not applying its pending state when to has a trailing slash (#​15300)
  • Preserve RSC route component metadata so routes with a clientLoader can skip unnecessary server requests once their components have rendered while still fetching missing server-rendered elements (#​15323)
  • Harden RSC CSRF code paths (#​15311)
  • Fix server crash (TypeError: Invalid state: Unable to enqueue) when a request is aborted while the RSC HTML stream has a pending flush (#​15286)
    • Handle cancellation of the injectRSCPayload readable side, clear the pending flush, and cancel the underlying RSC payload stream
Unstable Changes

⚠️ Unstable features are not recommended for production use

  • Detect stale RSC clients during lazy route discovery and reload the destination document (#​15318)
Migration

Apps using the default RSC Framework entry do not need to make any changes. Apps with a custom entry.rsc.tsx should import the generated client version and pass it to unstable_matchRSCServerRequest:

import clientVersion from "virtual:react-router/unstable_rsc/client-version";

return unstable_matchRSCServerRequest({
  // ...
  clientVersion,
});
  • Add CSP nonce support to RSC document rendering (#​15320)

    • Add nonce options to unstable_routeRSCServerRequest and unstable_RSCStaticRouter
    • Forward the nonce to the HTML renderer and apply it to injected RSC payload scripts and nonce-aware framework components

    To adopt nonce-based CSP, update your entry.ssr.tsx (run react-router reveal entry.ssr first in RSC Framework Mode) to generate a fresh nonce for each request. Pass it to routeRSCServerRequest, spread the renderHTML options into React's HTML renderer, pass options.nonce to RSCStaticRouter, and use the same nonce in the Content-Security-Policy response header:

    const nonce = crypto.randomUUID();
    const response = await routeRSCServerRequest({
      request,
      serverResponse,
      createFromReadableStream,
      nonce,
      async renderHTML(getPayload, options) {
        const payload = getPayload();
        return renderHTMLToReadableStream(
          <RSCStaticRouter getPayload={getPayload} nonce={options.nonce} />,
          {
            ...options,
            bootstrapScriptContent,
            formState: await payload.formState,
            signal: request.signal,
          },
        );
      },
    });
    response.headers.set(
      "Content-Security-Policy",
      `script-src 'self' 'nonce-${nonce}'`,
    );
    

v8.2.0

Compare Source

Patch Changes
  • Fix href() to properly stringify and URL-encode param values, matching generatePath() (#​15277)
    • splat params preserve path separators while encoding each segment individually
  • Fix dynamic param extraction for routes with optional static segments (#​15200)
    • When a route path contains optional static segments (e.g. /school?/user/:id), the internal regex's incorrectly shifted parameter indices resulting in incorrect parameter extraction
    • Consecutive optional static segments (e.g. /one?/two?) were only partially handled
  • Preserve navigation blocker state through a revalidation (#​15246)
  • Fix route ranking for dynamic parameters with static extension suffixes (#​15273)
    • These were not being detected as dynamic param segments and instead got incorrectly scored higher as a static segment
    • This meant they could potentially tie truly static routes like /sitemap.xml and outrank them based on definition order
    • These are now correctly identified as dynamic parameter segments and scored correctly
  • Use ReactFormState types instead of unknown (#​15263)

v8.1.0

Compare Source

Minor Changes
  • Return route metadata from server request, client navigation, and client fetcher instrumentations (#​15235)
    • Adds result metadata after instrumented calls complete, including the URL, matched route pattern, and params
    • Adds known HTTP status codes to server request handler instrumentation results

v8.0.1

Compare Source

Patch Changes
  • Remove the obsolete AppLoadContext type export accidentally left over from v7 now that middleware is always enabled and server request context is provided through RouterContextProvider. (#​15207)

v8.0.0

Compare Source

Major Changes
  • Remove the future.v8_trailingSlashAwareDataRequests flag (#​15100)
    • Trailing slash-aware data request URLs are now the default behavior.
  • Update tsconfig.json target/lib from ES2020 -> ES2022 (591853e)
  • Switch the published packages in packages/ to ESM-only. (#​14895) (59ebcf1)
  • Remove deprecated data parameter in favor of loaderData for meta APIs (to align with Route.ComponentProps) (#​14931)
    • Route.MetaArgs, Route.MetaMatch, MetaArgs, MetaMatch, Route.ComponentProps.matches, UIMatch
  • Remove future.v8_passThroughRequests flag - the raw incoming request is now always passed through to loader/action. Use url for the normalized URL without React Router-specific implementation details (.data suffixes, index/_routes search params). (#​15079)
  • Remove internal hasErrorBoundary field added to router.routes when using a data router (#​15074)
    • This should not impact user-facing code since this was an internal prop and was computed based on the presence of ErrorBoundary or errorElement on your route
    • hasErrorBoundary is no longer accepted on RouteObject (IndexRouteObject/NonIndexRouteObject), DataRouteObject, <Route> JSX props, or as a key in lazy route definitions.
    • The MapRoutePropertiesFunction signature no longer requires returning hasErrorBoundary; the router infers it directly.
  • Remove react-router-dom package (#​15076)
    • In v7 everything DOM-specific was collapsed into react-router/dom
      • react-router-dom was kept around as a convenience so existing v6 app imports would still work
    • For v8, you will need to swap react-router-dom imports:
      • RouterProvider/HydratedRouter should be imported from react-router/dom
      • Everything else should be imported from react-router
  • Remove future.v8_middleware flag — middleware is always enabled in v8 (#​15078)
    • The future.v8_middleware flag has been removed; middleware is now always enabled
    • The context parameter passed to loader, action, and middleware functions is always a RouterContextProvider instance
    • getLoadContext functions in custom servers must return a RouterContextProvider — returning a plain object is no longer supported
    • The MiddlewareEnabled type (previously exported as UNSAFE_MiddlewareEnabled) has been removed since the conditional it gated is now unconditional
    • The Future module augmentation pattern (interface Future { v8_middleware: true }) is no longer needed to type context in Data Mode
  • Update minimum Node version to 22.22.0 (#​14928)
  • Update minimum React version to 19.2.7 (#​15062)
Minor Changes
  • Bump dependencies (#​15080)
    • Bumped cookie from ^1.0.1 to ^1.1.1
    • Bumped set-cookie-parser from ^2.6.0 to ^3.1.0
Patch Changes
  • Ensure client middleware errors load lazy route error boundaries before bubbling (#​15086)
  • Remove explicit onSubmit type override from SharedFormProps to fix deprecation warning with @types/react@19.x (#​14932) (59ebcf1)
  • Update package builds to preserve individual module files in published artifacts. Public APIs and documented import paths are unchanged. (#​15092)
    • Updated package TypeScript configs to support modern module syntax used by the build configuration.
  • Migrate package builds from tsup to tsdown. Published package entry points and public APIs are unchanged. (#​15092)
  • Upgrade React Router's TypeScript tooling to TypeScript 6. Runtime behavior and public APIs are unchanged. (#​15092)

v7.18.6: v7.18.6

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7186

v7.18.5: v7.18.5

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7185

v7.18.4: v7.18.4

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7184

v7.18.3: v7.18.3

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7183

v7.18.2: v7.18.2

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7182

v7.18.1: v7.18.1

Compare Source

See the changelog for release notes: https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7181

v7.18.0

Compare Source

Patch Changes
  • Fix server handler prerender responses when using ssr: false and future.v8_trailingSlashAwareDataRequests: true. Avoids false positive "SPA Mode" detection when serving prerendered paths (#​15173)
  • Use the ServerRouter nonce for nonce-aware SSR components when they don't provide their own value so strict CSP pages can load them. (#​15170)
  • Use turbo-stream to serialize and deserialize Framework Mode hydration errors (#​15175)
  • Precompute route branch matchers to avoid recompiling route path regexes during matching (#​15186)
  • Use the constructed request URL host when validating action request origins. (#​15185)
  • Remove the un-documented custom error serialization logic from Data Mode SSR built-in hydration flows (#​15175)
  • Validate protocols in RSC render redirects (#​15177)
  • Consolidate url normalization logic and better handle mixed slashes (#​15176)

v7.17.0

Compare Source

Minor Changes
  • Ship a subset of the official documentation inside the react-router package (#​15121)
    • Markdown docs are now available in node_modules/react-router/docs, letting AI coding agents and the React Router agent skills read official docs locally
    • Excludes auto-generated API docs (api/), community/ content, and tutorials (tutorials/)

v7.16.0

Compare Source

Minor Changes
  • Stabilize future.unstable_trailingSlashAwareDataRequests as future.v8_trailingSlashAwareDataRequests (#​15098)
Patch Changes
  • Disable manifest path when lazy route dicovery is disabled (#​15068)

  • Fix browser URL creation to use the configured history window instead of the global window. (#​15066)

    • Pass the history/router window through to createBrowserURLImpl so custom window contexts keep the correct URL origin.
  • Fix useNavigation() return type to preserve discriminated union across navigation states (#​15095)

  • Widen MetaDescriptor script:ld+json type from LdJsonObject to LdJsonObject | LdJsonObject[] to permit multiple JSON-LD schemas in a single <script type="application/ld+json"> tag emitted by <Meta /> (#​15082)

v7.15.1

Compare Source

Patch Changes
  • Update router to operate on fetcher Maps in an immutable manner to avoid delayed React renders from potentially reading an updated but not yet committed Map. This could result in brief flickers in some fetcher-driven optimistic UI scenarios. (#​15028)
  • Fix serverLoader() returning stale SSR data when a client navigation aborts pending hydration before the hydration clientLoader resolves (#​15022)
  • Fix RouterProvider onError callback not being called for synchronous initial loader errors in SPA mode (#​15039) (#​14942)
  • Memoize useFetchers to return a stable identity and only change if fetchers changed (#​15028)
  • Internal refactor to consolidate mutation request detection through shared utility (#​15033)
Unstable Changes

⚠️ Unstable features are not recommended for production use

  • Add a new unstable_useRouterState() hook that consolidates access to active and pending router states (RFC: #​12358) (#​15017)
    • Data/Framework/RSC only — throws when used without a data router

    • This should allow you to consolidate usages of the following hooks which will likely be deprecated and removed in a future major version

      • useLocation
      • useSearchParams
      • useParams
      • useMatches
      • useNavigationType
      • useNavigation
      let { active, pending } = unstable_useRouterState();
      
      // Active is always populated with the current location
      active.location; // replaces `useLocation()`
      active.searchParams; // replaces `useSearchParams()[0]`
      active.params; // replaces `useParams()`
      active.matches; // replaces `useMatches()`
      active.type; // replaces `useNavigationType()`
      
      // Pending is only populated during a navigation
      pending.location; // replaces `useNavigation().location`
      pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
      pending.params; // Not directly accessible today
      pending.matches; // Not directly accessible today
      pending.type; // Not directly accessible today
      pending.state; // replaces `useNavigation().state`
      pending.formMethod; // replaces useNavigation().formMethod
      pending.formAction; // replaces useNavigation().formAction
      pending.formEncType; // replaces useNavigation().formEncType
      pending.formData; // replaces useNavigation().formData
      pending.json; // replaces useNavigation().json
      pending.text; // replaces useNavigation().text
      

v7.15.0

Compare Source

Minor Changes
  • Stabilize unstable_defaultShouldRevalidate as defaultShouldRevalidate on <Link>, <Form>, useLinkClickHandler, useSubmit, fetcher.submit, and setSearchParams (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize the instrumentation APIs. unstable_instrumentations is now instrumentations and unstable_pattern is now pattern (a993f09)

    • The unstable_ServerInstrumentation, unstable_ClientInstrumentation, unstable_InstrumentRequestHandlerFunction, unstable_InstrumentRouterFunction, unstable_InstrumentRouteFunction, and unstable_InstrumentationHandlerResult types have had their unstable_ prefixes removed
    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize unstable_mask as mask on <Link>, useLinkClickHandler, and useNavigate, and rename the corresponding Location.unstable_mask field to Location.mask (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize the unstable_normalizePath option on staticHandler.query and staticHandler.queryRoute as normalizePath (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize future.unstable_passThroughRequests as future.v8_passThroughRequests (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Remove unstable_subResourceIntegrity from the runtime FutureConfig type; the flag is now controlled by the top-level subResourceIntegrity option in react-router.config.ts (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize unstable_url as url on loader, action, and middleware function args (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
  • Stabilize unstable_useTransitions as useTransitions on <BrowserRouter>, <HashRouter>, <HistoryRouter>, <MemoryRouter>, <Router>, <RouterProvider>, <HydratedRouter>, and useLinkClickHandler (a993f09)

    • ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
Patch Changes
  • Add nonce to <Scripts> <link rel="modulepreload"> elements (if provided) (af5d49b)

  • Fix a bug with unstable_defaultShouldRevalidate={false} where parent routes that did not export a shouldRevalidate function could be incorrectly included in the single fetch call for new child route data (#​15012)

  • Improve server-side route matching performance by pre-computing flattened/cached route branches (#​14967) (af5d49b)

    • Performance benchmarks showed roughly a 10-15% improvement in server-side request handling performance
  • Mark mask as an optional field in Location for easier mocking in unit tests (#​14999)

  • Cache flattened/ranked route branches to optimize server-side route matching (#​14967)

  • Improve route matching performance in Framework/Data Mode (#​14971) (af5d49b)

    • Avoiding unnecessary calls to matchRoutes in data router scenarios
      • This includes adding back the optimization that was removed in 7.6.0 (#​13562)
      • The issues that prompted the revert have been addressed by using the available router matches but always updating match.route to the latest route in the manifest
    • Leverage pre-computed pre-computing flattened/cached route branches during client side route matching
    • Performance benchmarks showed roughly a 15-30% improvement in server-side request handling performance

v7.14.2

Compare Source

Patch Changes
  • Remove the un-documented custom error serialization logic from the internal turbo-stream implementation. React Router only automatically handles serialization of Error and it's standard subtypes (SyntaxError, TypeError, etc.). ([aabf4a1)

  • Properly handle parent middleware redirects during fetcher.load ([aabf4a1)

  • Remove redundant Omit<RouterProviderProps, "flushSync"> from react-router/dom RouterProvider ([aabf4a1)

  • Improved types for generatePath's param arg ([aabf4a1)

    Type errors when required params are omitted:

    // Before
    // Passes type checks, but throws at runtime 💥
    generatePath(":required", { required: null });
    
    // After
    generatePath(":required", { required: null });
    //                          ^^^^^^^^ Type 'null' is not assignable to type 'string'.ts(2322)
    

    Allow omission of optional params:

    // Before
    generatePath(":optional?", {});
    //                         ^^ Property 'optional' is missing in type '{}' but required in type '{ optional: string | null | undefined; }'.ts(2741)
    
    // After
    generatePath(":optional?", {});
    

    Allows extra keys:

    // Before
    generatePath(":a", { a: "1", b: "2" });
    //                           ^ Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.ts(2353)
    
    // After
    generatePath(":a", { a: "1", b: "2" });
    

v7.14.1

Compare Source

Patch Changes
  • Fix a potential race condition that can occur when rendering a HydrateFallback and initial loaders land before the router.subscribe call happens in the RouterProvider layout effect
  • Normalize double-slashes in redirect paths

v7.14.0

Compare Source

Patch Changes
  • UNSTABLE RSC FRAMEWORK MODE BREAKING CHANGE - Existing route module exports remain unchanged from stable v7 non-RSC mode, but new exports are added for RSC mode. If you want to use RSC features, you will need to update your route modules to export the new annotations. (#​14901)

    If you are using RSC framework mode currently, you will need to update your route modules to the new conventions. The following route module components have their own mutually exclusive server component counterparts:

    Server Component Export Client Component
    ServerComponent default
    ServerErrorBoundary ErrorBoundary
    ServerLayout Layout
    ServerHydrateFallback HydrateFallback

    If you were previously exporting a ServerComponent, your ErrorBoundary, Layout, and HydrateFallback were also server components. If you want to keep those as server components, you can rename them and prefix them with Server. If you were previously importing the implementations of those components from a client module, you can simply inline them.

    Example:

    Before

    import { ErrorBoundary as ClientErrorBoundary } from "./client";
    
    export function ServerComponent() {
      // ...
    }
    
    export function ErrorBoundary() {
      return <ClientErrorBoundary />;
    }
    
    export function Layout() {
      // ...
    }
    
    export function HydrateFallback() {
      // ...
    }
    

    After

    export function ServerComponent() {
      // ...
    }
    
    export function ErrorBoundary() {
      // previous implementation of ClientErrorBoundary, this is now a client component
    }
    
    export function ServerLayout() {
      // rename previous Layout export to ServerLayout to make it a server component
    }
    
    export function ServerHydrateFallback() {
      // rename previous HydrateFallback export to ServerHydrateFallback to make it a server component
    }
    
  • rsc Link prefetch (#​14902)

  • Remove recursion from turbo-stream v2 allowing for encoding / decoding of massive payloads. (#​14838)

  • encodeViaTurboStream leaked memory via unremoved AbortSignal listener (#​14900)

v7.13.2

Compare Source

Patch Changes
  • Fix clientLoader.hydrate when an ancestor route is also hydrating a clientLoader (#​14835)

  • Fix type error when passing Framework Mode route components using Route.ComponentProps to createRoutesStub (#​14892)

  • Fix percent encoding in relative path navigation (#​14786)

  • Add future.unstable_passThroughRequests flag (#​14775)

    By default, React Router normalizes the request.url passed to your loader, action, and middleware functions by removing React Router's internal implementation details (.data suffixes, index + _routes query params).

    Enabling this flag removes that normalization and passes the raw HTTP request instance to your handlers. This provides a few benefits:

    • Reduces server-side overhead by eliminating multiple new Request() calls on the critical path
    • Allows you to distinguish document from data requests in your handlers base don the presence of a .data suffix (useful for observability purposes)

    If you were previously relying on the normalization of request.url, you can switch to use the new sibling unstable_url parameter which contains a URL instance representing the normalized location:

    // ❌ Before: you could assume there was no `.data` suffix in `request.url`
    export async function loader({ request }: Route.LoaderArgs) {
      let url = new URL(request.url);
      if (url.pathname === "/path") {
        // This check will fail with the flag enabled because the `.data` suffix will
        // exist on data requests
      }
    }
    
    // ✅ After: use `unstable_url` for normalized routing logic and `request.url`
    // for raw routing logic
    export async function loader({ request, unstable_url }: Route.LoaderArgs) {
      if (unstable_url.pathname === "/path") {
        // This will always have the `.data` suffix stripped
      }
    
      // And now you can distinguish between document versus data requests
      let isDataRequest = new URL(request.url).pathname.endsWith(".data");
    }
    
  • Internal refactor to consolidate framework-agnostic/React-specific route type layers - no public API changes (#​14765)

  • Sync protocol validation to rsc flows (#​14882)

  • Add a new unstable_url: URL parameter to route handler methods (loader, action, middleware, etc.) representing the normalized URL the application is navigating to or fetching, with React Router implementation details removed (.datasuffix, index/_routes query params) (#​14775)

    This is being added alongside the new future.unstable_passthroughRequests future flag so that users still have a way to access the normalized URL when that flag is enabled and non-normalized request's are being passed to your handlers. When adopting this flag, you will only need to start leveraging this new parameter if you are relying on the normalization of request.url in your application code.

    If you don't have the flag enabled, then unstable_url will match request.url.

v7.13.1

Compare Source

Patch Changes
  • fix null reference exception in bad codepath leading to invalid route tree comparisons (#​14780)

  • fix: clear timeout when turbo-stream encoding completes (#​14810)

  • Improve error message when Origin header is invalid (#​14743)

  • Fix matchPath optional params matching without a "/" separator. (#​14689)

    • matchPath("/users/:id?", "/usersblah") now returns null.
    • matchPath("/test_route/:part?", "/test_route_more") now returns null.
  • add RSC unstable_getRequest (#​14758)

  • Fix HydrateFallback rendering during initial lazy route discovery with matching splat route (#​14740)

  • [UNSTABLE] Add support for <Link unstable_mask> in Data Mode which allows users to navigate to a URL in the router but "mask" the URL displayed in the browser. This is useful for contextual routing usages such as displaying an image in a model on top of a gallery, but displaying a browser URL directly to the image that can be shared and loaded without the contextual gallery in the background. (#​14716)

    // routes/gallery.tsx
    export function clientLoader({ request }: Route.LoaderArgs) {
      let sp = new URL(request.url).searchParams;
      return {
        images: getImages(),
        // When the router location has the image param, load the modal data
        modalImage: sp.has("image") ? getImage(sp.get("image")!) : null,
      };
    }
    
    export default function Gallery({ loaderData }: Route.ComponentProps) {
      return (
        <>
          <GalleryGrid>
            {loaderData.images.map((image) => (
              <Link
                key={image.id}
                {/* Navigate the router to /galley?image=N */}}
                to={`/gallery?image=${image.id}`}
                {/* But display /images/N in the URL bar */}}
                unstable_mask={`/images/${image.id}`}
              >
                <img src={image.url} alt={image.alt} />
              </Link>
            ))}
          </GalleryGrid>
    
          {/* When the modal data exists, display the modal */}
          {data.modalImage ? (
            <dialog open>
              <img src={data.modalImage.url} alt={data.modalImage.alt} />
            </dialog>
          ) : null}
        </>
      );
    }
    

    Notes:

    • The masked location, if present, will be available on useLocation().unstable_mask so you can detect whether you are currently masked or not.
    • Masked URLs only work for SPA use cases, and will be removed from history.state during SSR.
    • This provides a first-class API to mask URLs in Data Mode to achieve the same behavior you could do in Declarative Mode via manual backgroundLocation management.
  • RSC: Update failed origin checks to return a 400 status and appropriate UI instead of a generic 500 (#​14755)

  • Preserve query parameters and hash on manifest version mismatch reload (#​14813)

v7.13.0

Compare Source

Minor Changes
  • Add crossOrigin prop to Links component (#​14687)
Patch Changes
  • Fix double slash normalization for useNavigate colon urls (#​14718)
  • Update failed origin checks to return a 400 status instead of a 500 (#​14737)
  • Bugfix #​14666: Inline criticalCss is missing nonce (#​14691)
  • Loosen allowedActionOrigins glob check so ** matches all domains (#​14722)

v7.12.0

Compare Source

Minor Changes
  • Add additional layer of CSRF protection by rejecting submissions to UI routes from external origins. If you need to permit access to specific external origins, you can specify them in the react-router.config.ts config allowedActionOrigins field. (#​14708)
Patch Changes
  • Fix generatePath when used with suffixed params (i.e., "/books/:id.json") (#​14269)

  • Export UNSAFE_createMemoryHistory and UNSAFE_createHashHistory alongside UNSAFE_createBrowserHistory for consistency. These are not intended to be used for new apps but intended to help apps usiong unstable_HistoryRouter migrate from v6->v7 so they can adopt the newer APIs. (#​14663)

  • Escape HTML in scroll restoration keys (#​14705)

  • Validate redirect locations (#​14706)

  • [UNSTABLE] Pass <Scripts nonce> value through to the underlying importmap script tag when using future.unstable_subResourceIntegrity (#​14675)

  • [UNSTABLE] Add a new future.unstable_trailingSlashAwareDataRequests flag to provide consistent behavior of request.pathname inside middleware, loader, and action functions on document and data requests when a trailing slash is present in the browser URL. (#​14644)

    Currently, your HTTP and request pathnames would be as follows for /a/b/c and /a/b/c/

    URL /a/b/c HTTP pathname request pathname`
    Document /a/b/c /a/b/c ✅
    Data /a/b/c.data /a/b/c ✅
    URL /a/b/c/ HTTP pathname request pathname`
    Document /a/b/c/ /a/b/c/ ✅
    Data /a/b/c.data /a/b/c ⚠️

    With this flag enabled, these pathnames will be made consistent though a new _.data format for client-side .data requests:

    URL /a/b/c HTTP pathname request pathname`
    Document /a/b/c /a/b/c ✅
    Data /a/b/c.data /a/b/c ✅
    URL /a/b/c/ HTTP pathname request pathname`
    Document /a/b/c/ /a/b/c/ ✅
    Data /a/b/c/_.data ⬅️ /a/b/c/ ✅

    This a bug fix but we are putting it behind an opt-in flag because it has the potential to be a "breaking bug fix" if you are relying on the URL format for any other application or caching logic.

    Enabling this flag also changes the format of client side .data requests from /_root.data to /_.data when navigating to / to align with the new format. This does not impact the request pathname which is still / in all cases.

  • Preserve clientLoader.hydrate=true when using <HydratedRouter unstable_instrumentations> (#​14674)

v7.11.0

Compare Source

Minor Changes
  • Stabilize <HydratedRouter onError>/<RouterProvider onError> (#​14546)
Patch Changes
  • add support for throwing redirect Response's at RSC render time (#​14596)

  • Support for throwing data() and Response from server component render phase. Response body is not serialized as async work is not allowed as error encoding phase. If you wish to transmit data to the boundary, throw data() instead. (#​14632)

  • Fix unstable_useTransitions prop on <Router> component to permit omission for backewards compatibility (#​14646)

  • routeRSCServerRequest replace fetchServer with serverResponse (#​14597)

  • [UNSTABLE] Add a new unstable_defaultShouldRevalidate flag to various APIs to allow opt-ing out of standard revalidation behaviors. (#​14542)

    If active routes include a shouldRevalidate function, then your value will be passed as defaultShouldRevalidate in those function so that the route always has the final revalidation determination.

    • <Form method="post" unstable_defaultShouldRevalidate={false}>
    • submit(data, { method: "post", unstable_defaultShouldRevalidate: false })
    • <fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>
    • fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })

    This is also available on non-submission APIs that may trigger revalidations due to changing search params:

    • <Link to="/" unstable_defaultShouldRevalidate={false}>
    • navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })
    • setSearchParams(params, { unstable_defaultShouldRevalidate: false })
  • Allow redirects to be returned from client side middleware (#​14598)

  • Handle dataStrategy implementations that return insufficient result sets by adding errors for routes without any available result (#​14627)

v7.10.1

Compare Source

Patch Changes
  • Update the useOptimistic stub we provide for React 18 users to use a stable setter function to avoid potential useEffect loops - specifically when using <Link viewTransition> (#​14628)

v7.10.0

Compare Source

Minor Changes
  • Stabilize fetcher.reset() (#​14545)

    • ⚠️ This is a breaking change if you have begun using fetcher.unstable_reset()
  • Stabilize the dataStrategy match.shouldRevalidateArgs/match.shouldCallHandler() APIs. (#​14592)

    • The match.shouldLoad API is now marked deprecated in favor of these more powerful alternatives

    • If you're using this API in a custom dataStrategy today, you can swap to the new API at your convenience:

      // Before
      const matchesToLoad = matches.filter((m) => m.shouldLoad);
      
      // After
      const matchesToLoad = matches.filter((m) => m.shouldCallHandler());
      
    • match.shouldRevalidateArgs is the argument that will be passed to the route shouldRevaliate function

    • Combined with the parameter accepted by match.shouldCallHandler, you can define a custom revalidation behavior for your dataStrategy:

    const matchesToLoad = matches.filter((m) => {
      const defaultShouldRevalidate = customRevalidationBehavior(
        match.shouldRevalidateArgs,
      );
      return m.shouldCallHandler(defaultShouldRevalidate);
      // The argument here will override the internal `defaultShouldRevalidate` value
    });
    
Patch Changes
  • Fix a Framework Mode bug where the defaultShouldRevalidate parameter to shouldRevalidate would not be correct after action returned a 4xx/5xx response (true when it should have been false) (#​14592)

    • If your shouldRevalidate function relied on that parameter, you may have seen unintended revalidations
  • Fix fetcher.submit failing with plain objects containing a tagName property (#​14534)

  • [UNSTABLE] Add unstable_pattern to the parameters for client side unstable_onError, refactor how it's called by RouterProvider to avoid potential strict mode issues (#​14573)

  • Add new unstable_useTransitions flag to routers to give users control over the usage of React.startTransition and React.useOptimistic. (#​14524)

    • Framework Mode + Data Mode:
      • <HydratedRouter unstable_transition>/<RouterProvider unstable_transition>
      • When left unset (current default behavior)
        • Router state updates are wrapped in React.startTransition
        • ⚠️ This can lead to buggy behaviors if you are wrapping your own navigations/fetchers in React.startTransition
        • You should set the flag to true if you run into this scenario to get the enhanced useOptimistic behavior (requires React 19)
      • When set to true
        • Router state updates remain wrapped in React.startTransition (as they are without the flag)
        • Link/Form navigations will be wrapped in React.startTransition
        • A subset of router state info will be surfaced to the UI during navigations via React.useOptimistic (i.e., useNavigation(), useFetchers(), etc.)
          • ⚠️ This is a React 19 API so you must also be React 19 to opt into this flag for Framework/Data Mode
      • When set to false
        • The router will not leverage React.startTransition or React.useOptimistic on any navigations or state changes
    • Declarative Mode
      • <BrowserRouter unstable_useTransitions>
      • When left unset
        • Router state updates are wrapped in React.startTransition
      • When set to true
        • Router state updates remain wrapped in React.startTransition (as they are without the flag)
        • Link/Form navigations will be wrapped in React.startTransition
      • When set to false
        • the router will not leverage React.startTransition on any navigations or state changes
  • Fix the promise returned from useNavigate in Framework/Data Mode so that it properly tracks the duration of popstate navigations (i.e., navigate(-1)) (#​14524)

  • Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled (#​14577)

  • Preserve statusText on the ErrorResponse instance when throwing data() from a route handler (#​14555)

  • Optimize href() to avoid backtracking regex on splat (#​14329)

v7.9.6

Compare Source

Patch Changes
  • [UNSTABLE] Add location/params as arguments to client-side unstable_onError to permit enhanced error reporting. (#​14509)

    ⚠️ This is a breaking change if you've already adopted unstable_onError. The second errorInfo parameter is now an object with location and params:

    // Before
    function errorHandler(error: unknown, errorInfo?: React.errorInfo) {
      /*...*/
    }
    
    // After
    function errorHandler(
      error: unknown,
      info: {
        location: Location;
        params: Params;
        errorInfo?: React.ErrorInfo;
      },
    ) {
      /*...*/
    }
    
  • Properly handle ancestor thrown middleware errors before next() on fetcher submissions (#​14517)

  • Fix issue with splat routes interfering with multiple calls to patchRoutesOnNavigation (#​14487)

  • Normalize double-slashes in resolvePath (#​14529)

v7.9.5

Compare Source

Patch Changes
  • Move RSCHydratedRouter and utils to /dom export. (#​14457)

  • useRoute: return type-safe handle (#​14462)

    For example:

    // app/routes/admin.tsx
    const handle = { hello: "world" };
    
    // app/routes/some-other-route.tsx
    export default function Component() {
      const admin = useRoute("routes/admin");
      if (!admin) throw new Error("Not nested within 'routes/admin'");
      console.log(admin.handle);
      //                ^? { hello: string }
    }
    
  • Ensure action handlers run for routes with middleware even if no loader is present (#​14443)

  • Add unstable_instrumentations API to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches (#​14412)

    • Framework Mode:
      • entry.server.tsx: export const unstable_instrumentations = [...]
      • entry.client.tsx: <HydratedRouter unstable_instrumentations={[...]} />
    • Data Mode
      • createBrowserRouter(routes, { unstable_instrumentations: [...] })

    This also adds a new unstable_pattern parameter to loaders/actions/middleware which contains the un-interpolated route pattern (i.e., /blog/:slug) which is useful for aggregating performance metrics by route

v7.9.4

Compare Source

Patch Changes
  • handle external redirects in from server actions (#​14400)

  • New (unstable) useRoute hook for accessing data from specific routes (#​14407)

    For example, let's say you have an admin route somewhere in your app and you want any child routes of admin to all have access to the loaderData and actionData from admin.

    // app/routes/admin.tsx
    import { Outlet } from "react-router";
    
    export const loader = () => ({ message: "Hello, loader!" });
    
    export const action = () => ({ count: 1 });
    
    export default function Component() {
      return (
        <div>
          {/* ... */}
          <Outlet />
          {/* ... */}
        </div>
      );
    }
    

    You might even want to create a reusable widget that all of the routes nested under admin could use:

    import { unstable_useRoute as useRoute } from "react-router";
    
    export function AdminWidget() {
      // How to get `message` and `count` from `admin` route?
    }
    

    In framework mode, useRoute knows all your app's routes and gives you TS errors when invalid route IDs are passed in:

    export function AdminWidget() {
      const admin = useRoute("routes/dmin");
      //                      ^^^^^^^^^^^
    }
    

    useRoute returns undefined if the route is not part of the current page:

    export function AdminWidget() {
      const admin = useRoute("routes/admin");
      if (!admin) {
        throw new Error(`AdminWidget used outside of "routes/admin"`);
      }
    }
    

    Note: the root route is the exception since it is guaranteed to be part of the current page.
    As a result, useRoute never returns undefined for root.

    loaderData and actionData are marked as optional since they could be accessed before the action is triggered or after the loader threw an error:

    export function AdminWidget() {
      const admin = useRoute("routes/admin");
      if (!admin) {
        throw new Error(`AdminWidget used outside of "routes/admin"`);
      }
      const { loaderData, actionData } = admin;
      console.log(loaderData);
      //          ^? { message: string } | undefined
      console.log(actionData);
      //          ^? { count: number } | undefined
    }
    

    If instead of a specific route, you wanted access to the current route's loaderData and actionData, you can call useRoute without arguments:

    export function AdminWidget() {
      const currentRoute = useRoute();
      currentRoute.loaderData;
      currentRoute.actionData;
    }
    

    This usage is equivalent to calling useLoaderData and useActionData, but consolidates all route data access into one hook: useRoute.

    Note: when calling useRoute() (without a route ID), TS has no way to know which route is the current route.
    As a result, loaderData and actionData are typed as unknown.
    If you want more type-safety, you can either narrow the type yourself with something like zod or you can refactor your app to pass down typed props to your AdminWidget:

    export function AdminWidget({
      message,
      count,
    }: {
      message: string;
      count: number;
    }) {
      /* ... */
    }
    

v7.9.3

Compare Source

Patch Changes
  • Do not try to use turbo-stream to decode CDN errors that never reached the server (#​14385)

    • We used to do this but lost this check with the adoption of single fetch
  • Fix Data Mode regression causing a 404 during initial load in when middleware exists without any loader functions (#​14393)

v7.9.2

Compare Source

Patch Changes
    • Update client-side router to run client middleware on initial load even if no loaders exist (#​14348)
    • Update createRoutesStub to run route middleware
      • You will need to set the <RoutesStub future={{ v8_middleware: true }} /> flag to enable the proper context type
  • Update Lazy Route Discovery manifest requests to use a singular comma-separated paths query param instead of repeated p query params (#​14321)

    • This is because Cloudflare has a hard limit of 100 URL search param key/value pairs when used as a key for caching purposes
    • If more that 100 paths were included, the cache key would be incomplete and could produce false-positive cache hits
  • [UNSTABLE] Add fetcher.unstable_reset() API (#​14206)

  • Made useOutlet element reference have stable identity in-between route chages (#​13382)

  • feat: enable full transition support for the rsc router (#​14362)

  • In RSC Data Mode, handle SSR'd client errors and re-try in the browser (#​14342)

  • Support middleware prop on <Route> for usage with a data router via createRoutesFromElements (#​14357)

  • Handle encoded question mark and hash characters in ancestor splat routes (#​14249)

  • Fail gracefully on manifest version mismatch logic if sessionStorage access is blocked (#​14335)

v7.9.1

Compare Source

Patch Changes
  • Fix internal Future interface naming from middleware -> v8_middleware (#​14327)

v7.9.0

Compare Source

Minor Changes
Patch Changes
  • Escape HTML in meta() JSON-LD content (#​14316)
  • Add react-server Await component implementation (#​14261)
  • In RSC Data Mode when using a custom basename, fix hydration errors for routes that only have client loaders (#​14264)
  • Make href function available in a react-server context (#​14262)
  • decode each time getPayload() is called to allow for "in-context" decoding and hoisting of contextual assets (#​14248)
  • href() now correctly processes routes that have an extension after the parameter or are a single optional parameter. (#​13797)

v7.8.2

Compare Source

Patch Changes
  • [UNSTABLE] Remove Data Mode future.unstable_middleware flag from createBrowserRouter (#​14213)

    • This is only needed as a Framework Mode flag because of the route modules and the getLoadContext type behavior change
    • In Data Mode, it's an opt-in feature because it's just a new property on a route object, so there's no behavior changes that necessitate a flag
  • [UNSTABLE] Add <RouterProvider unstable_onError>/<HydratedRouter unstable_onError> prop for client side error reporting (#​14162)

  • server action revalidation opt out via $SKIP_REVALIDATION field (#​14154)

  • Properly escape interpolated param values in generatePath() (#​13530)

  • Maintain ReadonlyMap and ReadonlySet types in server response data. (#​13092)

  • [UNSTABLE] Delay serialization of .data redirects to 202 responses until after middleware chain (#​14205)

  • Fix TypeError if you throw from patchRoutesOnNavigation when no partial matches exist (#​14198)

  • Fix basename usage without a leading slash in data routers (#​11671)

  • [UNSTABLE] Update client middleware so it returns the data strategy results allowing for more advanced post-processing middleware (#​14151)

v7.8.1

Compare Source

Patch Changes
  • Fix usage of optional path segments in nested routes defined using absolute paths (#​14135)
  • Bubble client pre-next middleware error to the shallowest ancestor that needs to load, not strictly the shallowest ancestor with a loader (#​14150)
  • Fix optional static segment matching in matchPath (#​11813)
  • Fix prerendering when a basename is set with ssr:false (#​13791)
  • Provide isRouteErrorResponse utility in react-server environments (#​14166)
  • Propagate non-redirect Responses thrown from middleware to the error boundary on document/data requests (#​14182)
  • Handle meta and links Route Exports in RSC Data Mode (#​14136)
  • Properly convert returned/thrown data() values to Response instances via Response.json() in resource routes and middleware (#​14159, #​14181)

v7.8.0

Compare Source

Minor Changes
  • Add nonce prop to Links & PrefetchPageLinks (#​14048)
  • Add loaderData arguments/properties alongside existing data arguments/properties to provide consistency and clarity between loaderData and actionData across the board (#​14047)
    • Updated types: Route.MetaArgs, Route.MetaMatch, MetaArgs, MetaMatch, Route.ComponentProps.matches, UIMatch
    • @deprecated warnings have been added to the existing data properties to point users to new loaderData properties, in preparation for removing the data properties in a future major release
Patch Changes
  • Prevent "Did not find corresponding fetcher result" console error when navigating during a fetcher.submit revalidation (#​14114)

  • Bubble client-side middleware errors prior to next to the appropriate ancestor error boundary (#​14138)

  • Switch Lazy Route Discovery manifest URL generation to usea standalone URLSearchParams instance instead of URL.searchParams to avoid a major performance bottleneck in Chrome (#​14084)

  • Adjust internal RSC usage of React.use to avoid Webpack compilation errors when using React 18 (#​14113)

  • Remove dependency on @types/node in TypeScript declaration files (#​14059)

  • Fix types for UIMatch to reflect that the loaderData/data properties may be undefined (#​12206)

    • When an ErrorBoundary is being rendered, not all active matches will have loader data available, since it may have been their loader that threw to trigger the boundary
    • The UIMatch.data type was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when an ErrorBoundary was rendered
    • ⚠️ This may cause some type errors to show up in your code for unguarded match.data accesses - you should properly guard for undefined values in those scenarios.
    // app/root.tsx
    export function loader() {
      someFunctionThatThrows(); // ❌ Throws an Error
      return { title: "My Title" };
    }
    
    export function Layout({ children }: { children: React.ReactNode }) {
      let matches = useMatches();
      let rootMatch = matches[0] as UIMatch<Awaited<ReturnType<typeof loader>>>;
      //  ^ rootMatch.data is incorrectly typed here, so TypeScript does not
      //    complain if you do the following which throws an error at runtime:
      let { title } = rootMatch.data; // 💥
    
      return <html>...</html>;
    }
    
  • [UNSTABLE] Ensure resource route errors go through handleError w/middleware enabled (#​14078)

  • [UNSTABLE] Propagate returned Response from server middleware if next wasn't called (#​14093)

  • [UNSTABLE] Allow server middlewares to return data() values which will be converted into a Response (#​14093)

  • [UNSTABLE] Update middleware error handling so that the next function never throws and instead handles any middleware errors at the proper ErrorBoundary and returns the Response up through the ancestor next function (#​14118)

  • [UNSTABLE] When middleware is enabled, make the context parameter read-only (via Readonly<unstable_RouterContextProvider>) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. (#​14097)

  • [UNSTABLE] Rename and alter the signature/functionality of the unstable_respond API in staticHandler.query/staticHandler.queryRoute (#​14103)

    • The API has been renamed to unstable_generateMiddlewareResponse for clarity
    • The main functional change is that instead of running the loaders/actions before calling unstable_respond and handing you the result, we now pass a query/queryRoute function as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handling
    • The query version of the API now has a signature of (query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>
    • The queryRoute version of the API now has a signature of (queryRoute: (r: Request) => Promise<Response>) => Promise<Response>
    • This allows for more advanced usages such as running logic before/after calling query and direct error handling of errors thrown from query
    • ⚠️ This is a breaking change if you've adopted the staticHandler unstable_respond API
    let response = await staticHandler.query(request, {
      requestContext: new unstable_RouterContextProvider(),
      async unstable_generateMiddlewareResponse(query) {
        try {
          // At this point we've run middleware top-down so we need to call the
          // handlers and generate the Response to bubble back up the middleware
          let result = await query(request);
          if (isResponse(result)) {
            return result; // Redirects, etc.
          }
          return await generateHtmlResponse(result);
        } catch (error: unknown) {
          return generateErrorResponse(error);
        }
      },
    });
    
  • [UNSTABLE] Convert internal middleware implementations to use the new unstable_generateMiddlewareResponse API (#​14103)

  • [UNSTABLE] Change getLoadContext signature (type GetLoadContextFunction) when future.unstable_middleware is enabled so that it returns an unstable_RouterContextProvider instance instead of a Map used to contruct the instance internally (#​14097)

    • This also removes the type unstable_InitialContext export
    • ⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a getLoadContext function
  • [UNSTABLE] Run client middleware on client navigations even if no loaders exist (#​14106)

  • [UNSTABLE] Change the unstable_getContext signature on RouterProvider/HydratedRouter/unstable_RSCHydratedRouter so that it returns an unstable_RouterContextProvider instance instead of a Map used to contruct the instance internally (#​14097)

    • ⚠️ This is a breaking change if you have adopted the unstable_getContext prop
  • [UNSTABLE] proxy server action side-effect redirects from actions for document and callServer requests (#​14131)

  • [UNSTABLE] Fix RSC Data Mode issue where routes that return false from shouldRevalidate would be replaced by an <Outlet /> (#​14071)

v7.7.1

Compare Source

Patch Changes
  • In RSC Data Mode, fix bug where routes with errors weren't forced to revalidate when shouldRevalidate returned false (#​14026)
  • In RSC Data Mode, fix Matched leaf route at location "/..." does not have an element or Component warnings when error boundaries are rendered. (#​14021)

v7.7.0

Compare Source

Minor Changes
Patch Changes
  • Handle InvalidCharacterError when validating cookie signature (#​13847)

  • Pass a copy of searchParams to the setSearchParams callback function to avoid muations of the internal searchParams instance. This was an issue when navigations were blocked because the internal instance be out of sync with useLocation().search. (#​12784)

  • Support invalid Date in turbo-stream v2 fork (#​13684)

  • In Framework Mode, clear critical CSS in development after initial render (#​13872)

  • Strip search parameters from patchRoutesOnNavigation path param for fetcher calls (#​13911)

  • Skip scroll restoration on useRevalidator() calls because they're not new locations (#​13671)

  • Support unencoded UTF-8 routes in prerender config with ssr set to false (#​13699)

  • Do not throw if the url hash is not a valid URI component (#​13247)

  • Fix a regression in createRoutesStub introduced with the middleware feature. (#​13946)

    As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior AppLoadContext API. This permitted createRoutesStub to work if you were opting into middleware and the updated context typings, but broke createRoutesStub for users not yet opting into middleware.

    We've reverted this change and re-implemented it in such a way that both sets of users can leverage it.

    // If you have not opted into middleware, the old API should work again
    let context: AppLoadContext = {
      /*...*/
    };
    let Stub = createRoutesStub(routes, context);
    
    // If you have opted into middleware, you should now pass an instantiated `unstable_routerContextProvider` instead of a `getContext` factory function.
    let context = new unstable_RouterContextProvider();
    context.set(SomeContext, someValue);
    let Stub = createRoutesStub(routes, context);
    

    ⚠️ This may be a breaking bug for if you have adopted the unstable Middleware feature and are using createRoutesStub with the updated API.

  • Remove Content-Length header from Single Fetch responses (#​13902)

v7.6.3

Compare Source

Patch Changes
  • Do not serialize types for useRouteLoaderData<typeof clientLoader> (#​13752)

    For types to distinguish a clientLoader from a serverLoader, you MUST annotate clientLoader args:

    //                                   👇 annotation required to skip serializing types
    export function clientLoader({}: Route.ClientLoaderArgs) {
      return { fn: () => "earth" };
    }
    
    function SomeComponent() {
      const data = useRouteLoaderData<typeof clientLoader>("routes/this-route");
      const planet = data?.fn() ?? "world";
      return <h1>Hello, {planet}!</h1>;
    }
    

v7.6.2

Compare Source

Patch Changes
  • Avoid additional with-props chunk in Framework Mode by moving route module component prop logic from the Vite plugin to react-router (#​13650)
  • Slight refactor of internal headers() function processing for use with RSC (#​13639)

v7.6.1

Compare Source

Patch Changes
  • Update Route.MetaArgs to reflect that data can be potentially undefined (#​13563)

    This is primarily for cases where a route loader threw an error to it's own ErrorBoundary. but it also arises in the case of a 404 which renders the root ErrorBoundary/meta but the root loader did not run because not routes matched.

  • Partially revert optimization added in 7.1.4 to reduce calls to matchRoutes because it surfaced other issues (#​13562)

  • Fix typegen when same route is used at multiple paths (#​13574)

    For example, routes/route.tsx is used at 4 different paths here:

    import { type RouteConfig, route } from "@react-router/dev/routes";
    export default [
      route("base/:base", "routes/base.tsx", [
        route("home/:home", "routes/route.tsx", { id: "home" }),
        route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
        route("splat/*", "routes/route.tsx", { id: "splat" }),
      ]),
      route("other/:other", "routes/route.tsx", { id: "other" }),
    ] satisfies RouteConfig;
    

    Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
    Now, typegen creates unions as necessary for alternate paths for the same route file.

  • Better types for params (#​13543)

    For example:

    // routes.ts
    import { type RouteConfig, route } from "@react-router/dev/routes";
    
    export default [
      route("parent/:p", "routes/parent.tsx", [
        route("layout/:l", "routes/layout.tsx", [
          route("child1/:c1a/:c1b", "routes/child1.tsx"),
          route("child2/:c2a/:c2b", "routes/child2.tsx"),
        ]),
      ]),
    ] satisfies RouteConfig;
    

    Previously, params for the routes/layout.tsx route were calculated as { p: string, l: string }.
    This incorrectly ignores params that could come from child routes.
    If visiting /parent/1/layout/2/child1/3/4, the actual params passed to routes/layout.tsx will have a type of { p: string, l: string, c1a: string, c1b: string }.

    Now, params are aware of child routes and autocompletion will include child params as optionals:

    params.|
    //     ^ cursor is here and you ask for autocompletion
    // p: string
    // l: string
    // c1a?: string
    // c1b?: string
    // c2a?: string
    // c2b?: string
    

    You can also narrow the types for params as it is implemented as a normalized union of params for each page that includes routes/layout.tsx:

    if (typeof params.c1a === 'string') {
      params.|
      //     ^ cursor is here and you ask for autocompletion
      // p: string
      // l: string
      // c1a: string
      // c1b: string
    }
    

    UNSTABLE: renamed internal react-router/route-module export to react-router/internal
    UNSTABLE: removed Info export from generated +types/* files

  • Avoid initial fetcher execution 404 error when Lazy Route Discovery is interrupted by a navigation (#​13564)

  • href replaces splats * (#​13593)

    const a = href("/products/*", { "*": "/1/edit" });
    // -> /products/1/edit
    

v7.6.0

Compare Source

Minor Changes
  • Added a new react-router.config.ts routeDiscovery option to configure Lazy Route Discovery behavior. (#​13451)

    • By default, Lazy Route Discovery is enabled and makes manifest requests to the /__manifest path:
      • routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
    • You can modify the manifest path used:
      • routeDiscovery: { mode: "lazy", manifestPath: "/custom-manifest" }
    • Or you can disable this feature entirely and include all routes in the manifest on initial document load:
      • routeDiscovery: { mode: "initial" }
  • Add support for route component props in createRoutesStub. This allows you to unit test your route components using the props instead of the hooks: (#​13528)

    let RoutesStub = createRoutesStub([
      {
        path: "/",
        Component({ loaderData }) {
          let data = loaderData as { message: string };
          return <pre data-testid="data">Message: {data.message}</pre>;
        },
        loader() {
          return { message: "hello" };
        },
      },
    ]);
    
    render(<RoutesStub />);
    
    await waitFor(() => screen.findByText("Message: hello"));
    
Patch Changes
  • Fix react-router module augmentation for NodeNext (#​13498)

  • Don't bundle react-router in react-router/dom CJS export (#​13497)

  • Fix bug where a submitting fetcher would get stuck in a loading state if a revalidating loader redirected (#​12873)

  • Fix hydration error if a server loader returned undefined (#​13496)

  • Fix initial load 404 scenarios in data mode (#​13500)

  • Stabilize useRevalidator's revalidate function (#​13542)

  • Preserve status code if a clientAction throws a data() result in framework mode (#​13522)

  • Be defensive against leading double slashes in paths to avoid Invalid URL errors from the URL constructor (#​13510)

    • Note we do not sanitize/normalize these paths - we only detect them so we can avoid the error that would be thrown by new URL("//", window.location.origin)
  • Remove Navigator declaration for navigator.connection.saveData to avoid messing with any other types beyond saveData in userland (#​13512)

  • Fix handleError params values on .data requests for routes with a dynamic param as the last URL segment (#​13481)

  • Don't trigger an ErrorBoundary UI before the reload when we detect a manifest verison mismatch in Lazy Route Discovery (#​13480)

  • Inline turbo-stream@2.4.1 dependency and fix decoding ordering of Map/Set instances (#​13518)

  • Only render dev warnings in DEV mode (#​13461)

  • UNSTABLE: Fix a few bugs with error bubbling in middleware use-cases (#​13538)

  • Short circuit post-processing on aborted dataStrategy requests (#​13521)

    • This resolves non-user-facing console errors of the form Cannot read properties of undefined (reading 'result')

v7.5.3

Compare Source

Patch Changes
  • Fix bug where bubbled action errors would result in loaderData being cleared at the handling ErrorBoundary route (#​13476)
  • Handle redirects from clientLoader.hydrate initial load executions (#​13477)

v7.5.2

Compare Source

Patch Changes
  • Update Single Fetch to also handle the 204 redirects used in ?_data requests in Remix v2 (#​13364)

    • This allows applications to return a redirect on .data requests from outside the scope of React Router (i.e., an express/hono middleware)
    • ⚠️ Please note that doing so relies on implementation details that are subject to change without a SemVer major release
    • This is primarily done to ease upgrading to Single Fetch for existing Remix v2 applications, but the recommended way to handle this is redirecting from a route middleware
  • Adjust approach for Prerendering/SPA Mode via headers (#​13453)

v7.5.1

Compare Source

Patch Changes
  • Fix single fetch bug where no revalidation request would be made when navigating upwards to a reused parent route (#​13253)

  • When using the object-based route.lazy API, the HydrateFallback and hydrateFallbackElement properties are now skipped when lazy loading routes after hydration. (#​13376)

    If you move the code for these properties into a separate file, you can use this optimization to avoid downloading unused hydration code. For example:

    createBrowserRouter([
      {
        path: "/show/:showId",
        lazy: {
          loader: async () => (await import("./show.loader.js")).loader,
          Component: async () => (await import("./show.component.js")).Component,
          HydrateFallback: async () =>
            (await import("./show.hydrate-fallback.js")).HydrateFallback,
        },
      },
    ]);
    
  • Properly revalidate prerendered paths when param values change (#​13380)

  • UNSTABLE: Add a new unstable_runClientMiddleware argument to dataStrategy to enable middleware execution in custom dataStrategy implementations (#​13395)

  • UNSTABLE: Add better error messaging when getLoadContext is not updated to return a Map" (#​13242)

  • Do not automatically add null to staticHandler.query() context.loaderData if routes do not have loaders (#​13223)

    • This was a Remix v2 implementation detail inadvertently left in for React Router v7
    • Now that we allow returning undefined from loaders, our prior check of loaderData[routeId] !== undefined was no longer sufficient and was changed to a routeId in loaderData check - these null values can cause issues for this new check
    • ⚠️ This could be a "breaking bug fix" for you if you are doing manual SSR with createStaticHandler()/<StaticRouterProvider>, and using context.loaderData to control <RouterProvider> hydration behavior on the client
  • Fix prerendering when a loader returns a redirect (#​13365)

  • UNSTABLE: Update context type for LoaderFunctionArgs/ActionFunctionArgs when middleware is enabled (#​13381)

  • Add support for the new unstable_shouldCallHandler/unstable_shouldRevalidateArgs APIs in dataStrategy (#​13253)

v7.5.0

Compare Source

Minor Changes
  • Add granular object-based API for route.lazy to support lazy loading of individual route properties, for example: (#​13294)

    createBrowserRouter([
      {
        path: "/show/:showId",
        lazy: {
          loader: async () => (await import("./show.loader.js")).loader,
          action: async () => (await import("./show.action.js")).action,
          Component: async () => (await import("./show.component.js")).Component,
        },
      },
    ]);
    

    Breaking change for route.unstable_lazyMiddleware consumers

    The route.unstable_lazyMiddleware property is no longer supported. If you want to lazily load middleware, you must use the new object-based route.lazy API with route.lazy.unstable_middleware, for example:

    createBrowserRouter([
      {
        path: "/show/:showId",
        lazy: {
          unstable_middleware: async () =>
            (await import("./show.middleware.js")).middleware,
          // etc.
        },
      },
    ]);
    
Patch Changes
  • Introduce unstable_subResourceIntegrity future flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. (#​13163)

v7.4.1

Compare Source

Patch Changes
  • Fix types on unstable_MiddlewareFunction to avoid type errors when a middleware doesn't return a value (#​13311)

  • Dedupe calls to route.lazy functions (#​13260)

  • Add support for route.unstable_lazyMiddleware function to allow lazy loading of middleware logic. (#​13210)

    Breaking change for unstable_middleware consumers

    The route.unstable_middleware property is no longer supported in the return value from route.lazy. If you want to lazily load middleware, you must use route.unstable_lazyMiddleware.

v7.4.0

Compare Source

Patch Changes
  • Fix root loader data on initial load redirects in SPA mode (#​13222)
  • Load ancestor pathless/index routes in lazy route discovery for upwards non-eager-discoery routing (#​13203)
  • Fix shouldRevalidate behavior for clientLoader-only routes in ssr:true apps (#​13221)
  • UNSTABLE: Fix RequestHandler loadContext parameter type when middleware is enabled (#​13204)
  • UNSTABLE: Update Route.unstable_MiddlewareFunction to have a return value of Response | undefined instead of Response | void becaue you should not return anything if you aren't returning the Response (#​13199)
  • UNSTABLE(BREAKING): If a middleware throws an error, ensure we only bubble the error itself via next() and are no longer leaking the MiddlewareError implementation detail (#​13180)

v7.3.0

Compare Source

Minor Changes
  • Add fetcherKey as a parameter to patchRoutesOnNavigation (#​13061)
    • In framework mode, Lazy Route Discovery will now detect manifest version mismatches after a new deploy
    • On navigations to undiscovered routes, this mismatch will trigger a document reload of the destination path
    • On fetcher calls to undiscovered routes, this mismatch will trigger a document reload of the current path
Patch Changes
  • Skip resource route flow in dev server in SPA mode (#​13113)

  • Support middleware on routes (unstable) (#​12941)

    Middleware is implemented behind a future.unstable_middleware flag. To enable, you must enable the flag and the types in your react-router-config.ts file:

    import type { Config } from "@react-router/dev/config";
    import type { Future } from "react-router";
    
    declare module "react-router" {
      interface Future {
        unstable_middleware: true; // 👈 Enable middleware types
      }
    }
    
    export default {
      future: {
        unstable_middleware: true, // 👈 Enable middleware
      },
    } satisfies Config;
    

    ⚠️ Middleware is unstable and should not be adopted in production. There is at least one known de-optimization in route module loading for clientMiddleware that we will be addressing this before a stable release.

    ⚠️ Enabling middleware contains a breaking change to the context parameter passed to your loader/action functions - see below for more information.

    Once enabled, routes can define an array of middleware functions that will run sequentially before route handlers run. These functions accept the same parameters as loader/action plus an additional next parameter to run the remaining data pipeline. This allows middlewares to perform logic before and after handlers execute.

    // Framework mode
    export const unstable_middleware = [serverLogger, serverAuth]; // server
    export const unstable_clientMiddleware = [clientLogger]; // client
    
    // Library mode
    const routes = [
      {
        path: "/",
        // Middlewares are client-side for library mode SPA's
        unstable_middleware: [clientLogger, clientAuth],
        loader: rootLoader,
        Component: Root,
      },
    ];
    

    Here's a simple example of a client-side logging middleware that can be placed on the root route:

    const clientLogger: Route.unstable_ClientMiddlewareFunction = async (
      { request },
      next,
    ) => {
      let start = performance.now();
    
      // Run the remaining middlewares and all route loaders
      await next();
    
      let duration = performance.now() - start;
      console.log(`Navigated to ${request.url} (${duration}ms)`);
    };
    

    Note that in the above example, the next/middleware functions don't return anything. This is by design as on the client there is no "response" to send over the network like there would be for middlewares running on the server. The data is all handled behind the scenes by the stateful router.

    For a server-side middleware, the next function will return the HTTP Response that React Router will be sending across the wire, thus giving you a chance to make changes as needed. You may throw a new response to short circuit and respond immediately, or you may return a new or altered response to override the default returned by next().

    const serverLogger: Route.unstable_MiddlewareFunction = async (
      { request, params, context },
      next,
    ) => {
      let start = performance.now();
    
      // 👇 Grab the response here
      let res = await next();
    
      let duration = performance.now() - start;
      console.log(`Navigated to ${request.url} (${duration}ms)`);
    
      // 👇 And return it here (optional if you don't modify the response)
      return res;
    };
    

    You can throw a redirect from a middleware to short circuit any remaining processing:

    import { sessionContext } from "../context";
    const serverAuth: Route.unstable_MiddlewareFunction = (
      { request, params, context },
      next,
    ) => {
      let session = context.get(sessionContext);
      let user = session.get("user");
      if (!user) {
        session.set("returnTo", request.url);
        throw redirect("/login", 302);
      }
    };
    

    Note that in cases like this where you don't need to do any post-processing you don't need to call the next function or return a Response.

    Here's another example of using a server middleware to detect 404s and check the CMS for a redirect:

    const redirects: Route.unstable_MiddlewareFunction = async ({
      request,
      next,
    }) => {
      // attempt to handle the request
      let res = await next();
    
      // if it's a 404, check the CMS for a redirect, do it last
      // because it's expensive
      if (res.status === 404) {
        let cmsRedirect = await checkCMSRedirects(request.url);
        if (cmsRedirect) {
          throw redirect(cmsRedirect, 302);
        }
      }
    
      return res;
    };
    

    context parameter

    When middleware is enabled, your application will use a different type of context parameter in your loaders and actions to provide better type safety. Instead of AppLoadContext, context will now be an instance of ContextProvider that you can use with type-safe contexts (similar to React.createContext):

    import { unstable_createContext } from "react-router";
    import { Route } from "./+types/root";
    import type { Session } from "./sessions.server";
    import { getSession } from "./sessions.server";
    
    let sessionContext = unstable_createContext<Session>();
    
    const sessionMiddleware: Route.unstable_MiddlewareFunction = ({
      context,
      request,
    }) => {
      let session = await getSession(request);
      context.set(sessionContext, session);
      //                          ^ must be of type Session
    };
    
    // ... then in some downstream middleware
    const loggerMiddleware: Route.unstable_MiddlewareFunction = ({
      context,
      request,
    }) => {
      let session = context.get(sessionContext);
      //  ^ typeof Session
      console.log(session.get("userId"), request.method, request.url);
    };
    
    // ... or some downstream loader
    export function loader({ context }: Route.LoaderArgs) {
      let session = context.get(sessionContext);
      let profile = await getProfile(session.get("userId"));
      return { profile };
    }
    

    If you are using a custom server with a getLoadContext function, the return value for initial context values passed from the server adapter layer is no longer an object and should now return an unstable_InitialContext (Map<RouterContext, unknown>):

    let adapterContext = unstable_createContext<MyAdapterContext>();
    
    function getLoadContext(req, res): unstable_InitialContext {
      let map = new Map();
      map.set(adapterContext, getAdapterContext(req));
      return map;
    }
    
  • Fix types for loaderData and actionData that contained Records (#​13139)

    UNSTABLE(BREAKING):

    unstable_SerializesTo added a way to register custom serialization types in Single Fetch for other library and framework authors like Apollo.
    It was implemented with branded type whose branded property that was made optional so that casting arbitrary values was easy:

    // without the brand being marked as optional
    let x1 = 42 as unknown as unstable_SerializesTo<number>;
    //          ^^^^^^^^^^
    
    // with the brand being marked as optional
    let x2 = 42 as unstable_SerializesTo<number>;
    

    However, this broke type inference in loaderData and actionData for any Record types as those would now (incorrectly) match unstable_SerializesTo.
    This affected all users, not just those that depended on unstable_SerializesTo.
    To fix this, the branded property of unstable_SerializesTo is marked as required instead of optional.

    For library and framework authors using unstable_SerializesTo, you may need to add as unknown casts before casting to unstable_SerializesTo.

  • Fix single fetch _root.data requests when a basename is used (#​12898)

  • Add context support to client side data routers (unstable) (#​12941)

    Your application loader and action functions on the client will now receive a context parameter. This is an instance of unstable_RouterContextProvider that you use with type-safe contexts (similar to React.createContext) and is most useful with the corresponding middleware/clientMiddleware API's:

    import { unstable_createContext } from "react-router";
    
    type User = {
      /*...*/
    };
    
    let userContext = unstable_createContext<User>();
    
    function sessionMiddleware({ context }) {
      let user = await getUser();
      context.set(userContext, user);
    }
    
    // ... then in some downstream loader
    function loader({ context }) {
      let user = context.get(userContext);
      let profile = await getProfile(user.id);
      return { profile };
    }
    

    Similar to server-side requests, a fresh context will be created per navigation (or fetcher call). If you have initial data you'd like to populate in the context for every request, you can provide an unstable_getContext function at the root of your app:

    • Library mode - createBrowserRouter(routes, { unstable_getContext })
    • Framework mode - <HydratedRouter unstable_getContext>

    This function should return an value of type unstable_InitialContext which is a Map<unstable_RouterContext, unknown> of context's and initial values:

    const loggerContext = unstable_createContext<(...args: unknown[]) => void>();
    
    function logger(...args: unknown[]) {
      console.log(new Date.toISOString(), ...args);
    }
    
    function unstable_getContext() {
      let map = new Map();
      map.set(loggerContext, logger);
      return map;
    }
    

v7.2.0

Compare Source

Minor Changes
  • New type-safe href utility that guarantees links point to actual paths in your app (#​13012)

    import { href } from "react-router";
    
    export default function Component() {
      const link = href("/blog/:slug", { slug: "my-first-post" });
      return (
        <main>
          <Link to={href("/products/:id", { id: "asdf" })} />
          <NavLink to={href("/:lang?/about", { lang: "en" })} />
        </main>
      );
    }
    
Patch Changes
  • Fix typegen for repeated params (#​13012)

    In React Router, path parameters are keyed by their name.
    So for a path pattern like /a/:id/b/:id?/c/:id, the last :id will set the value for id in useParams and the params prop.
    For example, /a/1/b/2/c/3 will result in the value { id: 3 } at runtime.

    Previously, generated types for params incorrectly modeled repeated params with an array.
    So /a/1/b/2/c/3 generated a type like { id: [1,2,3] }.

    To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
    So /a/1/b/2/c/3 now generates a type like { id: 3 }.

  • Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request (#​12948)

  • Properly handle revalidations to across a prerender/SPA boundary (#​13021)

    • In "hybrid" applications where some routes are pre-rendered and some are served from a SPA fallback, we need to avoid making .data requests if the path wasn't pre-rendered because the request will 404
    • We don't know all the pre-rendered paths client-side, however:
      • All loader data in ssr:false mode is static because it's generated at build time
      • A route must use a clientLoader to do anything dynamic
      • Therefore, if a route only has a loader and not a clientLoader, we disable revalidation by default because there is no new data to retrieve
      • We short circuit and skip single fetch .data request logic if there are no server loaders with shouldLoad=true in our single fetch dataStrategy
      • This ensures that the route doesn't cause a .data request that would 404 after a submission
  • Error at build time in ssr:false + prerender apps for the edge case scenario of: (#​13021)

    • A parent route has only a loader (does not have a clientLoader)
    • The parent route is pre-rendered
    • The parent route has children routes which are not prerendered
    • This means that when the child paths are loaded via the SPA fallback, the parent won't have any loaderData because there is no server on which to run the loader
    • This can be resolved by either adding a parent clientLoader or pre-rendering the child paths
    • If you add a clientLoader, calling the serverLoader() on non-prerendered paths will throw a 404
  • Add unstable support for splitting route modules in framework mode via future.unstable_splitRouteModules (#​11871)

  • Add unstable_SerializesTo brand type for library authors to register types serializable by React Router's streaming format (turbo-stream) (ab5b05b02)

  • Align dev server behavior with static file server behavior when ssr:false is set (#​12948)

    • When no prerender config exists, only SSR down to the root HydrateFallback (SPA Mode)
    • When a prerender config exists but the current path is not prerendered, only SSR down to the root HydrateFallback (SPA Fallback)
    • Return a 404 on .data requests to non-pre-rendered paths
  • Improve prefetch performance of CSS side effects in framework mode (#​12889)

  • Disable Lazy Route Discovery for all ssr:false apps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured __manifest requests (#​12894)

    • We previously only disabled this for "SPA Mode" which is ssr:false and no prerender config but we realized it should apply to all ssr:false apps, including those prerendering multiple pages
    • In those prerender scenarios we would prerender the /__manifest file assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors
  • Properly handle interrupted manifest requests in lazy route discovery (#​12915)

v7.1.5

Compare Source

Patch Changes
  • Fix regression introduced in 7.1.4 via #​12800 that caused issues navigating to hash routes inside splat routes for applications using Lazy Route Discovery (patchRoutesOnNavigation) (#​12927)

v7.1.4

Compare Source

Patch Changes
  • Internal reorg to clean up some duplicated route module types (#​12799)
  • Properly handle status codes that cannot have a body in single fetch responses (204, etc.) (#​12760)
  • Stop erroring on resource routes that return raw strings/objects and instead serialize them as text/plain or application/json responses (#​12848)
    • This only applies when accessed as a resource route without the .data extension
    • When accessed from a Single Fetch .data request, they will still be encoded via turbo-stream
  • Optimize Lazy Route Discovery path discovery to favor a single querySelectorAll call at the body level instead of many calls at the sub-tree level (#​12731)
  • Properly bubble headers as errorHeaders when throwing a data() result (#​12846)
    • Avoid duplication of Set-Cookie headers could be duplicated if also returned from headers
  • Optimize route matching by skipping redundant matchRoutes calls when possible (#​12800)

v7.1.3

Compare Source

No changes

v7.1.2

Compare Source

Patch Changes
  • Fix issue with fetcher data cleanup in the data layer on fetcher unmount (#​12681)

  • Do not rely on symbol for filtering out redirect responses from loader data (#​12694)

    Previously, some projects were getting type checking errors like:

    error TS4058: Return type of exported function has or is using name 'redirectSymbol' from external module "node_modules/..." but cannot be named.
    

    Now that symbols are not used for the redirect response type, these errors should no longer be present.

v7.1.1

Compare Source

No changes

v7.1.0

Compare Source

Patch Changes
  • Throw unwrapped single fetch redirect to align with pre-single fetch behavior (#​12506)
  • Ignore redirects when inferring loader data types (#​12527)
  • Remove <Link prefetch> warning which suffers from false positives in a lazy route discovery world (#​12485)

v7.0.2

Compare Source

Patch Changes
  • temporarily only use one build in export map so packages can have a peer dependency on react router (#​12437)

  • Generate wide matches and params types for current route and child routes (#​12397)

    At runtime, matches includes child route matches and params include child route path parameters.
    But previously, we only generated types for parent routes in matches; for params, we only considered the parent routes and the current route.
    To align our generated types more closely to the runtime behavior, we now generate more permissive, wider types when accessing child route information.

v7.0.1

Compare Source

No changes

v7.0.0

Compare Source

Major Changes
  • Remove the original defer implementation in favor of using raw promises via single fetch and turbo-stream. This removes these exports from React Router: (#​11744)

    • defer
    • AbortedDeferredError
    • type TypedDeferredData
    • UNSAFE_DeferredData
    • UNSAFE_DEFERRED_SYMBOL,
    • Collapse @remix-run/router into react-router (#​11505)
    • Collapse react-router-dom into react-router
    • Collapse @remix-run/server-runtime into react-router
    • Collapse @remix-run/testing into react-router
  • Remove single fetch future flag. (#​11522)

  • Drop support for Node 16, React Router SSR now requires Node 18 or higher (#​11391)

  • Remove future.v7_startTransition flag (#​11696)

    • Expose the underlying router promises from the following APIs for compsition in React 19 APIs: (#​11521)
      • useNavigate()
      • useSubmit
      • useFetcher().load
      • useFetcher().submit
      • useRevalidator.revalidate
  • Remove future.v7_normalizeFormMethod future flag (#​11697)

  • For Remix consumers migrating to React Router, the crypto global from the Web Crypto API is now required when using cookie and session APIs. This means that the following APIs are provided from react-router rather than platform-specific packages: (#​11837)

    • createCookie
    • createCookieSessionStorage
    • createMemorySessionStorage
    • createSessionStorage

    For consumers running older versions of Node, the installGlobals function from @remix-run/node has been updated to define globalThis.crypto, using Node's require('node:crypto').webcrypto implementation.

    Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:

    • createCookieFactory
    • createSessionStorageFactory
    • createCookieSessionStorageFactory
    • createMemorySessionStorageFactory
  • Imports/Exports cleanup (#​11840)

    • Removed the following exports that were previously public API from @remix-run/router
      • types
        • AgnosticDataIndexRouteObject
        • AgnosticDataNonIndexRouteObject
        • AgnosticDataRouteMatch
        • AgnosticDataRouteObject
        • AgnosticIndexRouteObject
        • AgnosticNonIndexRouteObject
        • AgnosticRouteMatch
        • AgnosticRouteObject
        • TrackedPromise
        • unstable_AgnosticPatchRoutesOnMissFunction
        • Action -> exported as NavigationType via react-router
        • Router exported as DataRouter to differentiate from RR's <Router>
      • API
        • getToPathname (@private)
        • joinPaths (@private)
        • normalizePathname (@private)
        • resolveTo (@private)
        • stripBasename (@private)
        • createBrowserHistory -> in favor of createBrowserRouter
        • createHashHistory -> in favor of createHashRouter
        • createMemoryHistory -> in favor of createMemoryRouter
        • createRouter
        • createStaticHandler -> in favor of wrapper createStaticHandler in RR Dom
        • getStaticContextFromError
    • Removed the following exports that were previously public API from react-router
      • Hash
      • Pathname
      • Search
  • update minimum node version to 18 (#​11690)

  • Remove future.v7_prependBasename from the ionternalized @remix-run/router package (#​11726)

  • Migrate Remix type generics to React Router (#​12180)

    • These generics are provided for Remix v2 migration purposes
    • These generics and the APIs they exist on should be considered informally deprecated in favor of the new Route.* types
    • Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the Route.* types
    • For React Router v6 users, these generics are new and should not impact your app, with one exception
      • useFetcher previously had an optional generic (used primarily by Remix v2) that expected the data type
      • This has been updated in v7 to expect the type of the function that generates the data (i.e., typeof loader/typeof action)
      • Therefore, you should update your usages:
        • ❌ useFetcher<LoaderData>()
        • ✅ useFetcher<typeof loader>()
  • Remove future.v7_throwAbortReason from internalized @remix-run/router package (#​11728)

  • Add exports field to all packages (#​11675)

  • node package no longer re-exports from react-router (#​11702)

  • renamed RemixContext to FrameworkContext (#​11705)

  • updates the minimum React version to 18 (#​11689)

  • PrefetchPageDescriptor replaced by PageLinkDescriptor (#​11960)

    • Consolidate types previously duplicated across @remix-run/router, @remix-run/server-runtime, and @remix-run/react now that they all live in react-router (#​12177)
      • Examples: LoaderFunction, LoaderFunctionArgs, ActionFunction, ActionFunctionArgs, DataFunctionArgs, RouteManifest, LinksFunction, Route, EntryRoute
      • The RouteManifest type used by the "remix" code is now slightly stricter because it is using the former @remix-run/router RouteManifest
        • Record<string, Route> -> Record<string, Route | undefined>
      • Removed AppData type in favor of inlining unknown in the few locations it was used
      • Removed ServerRuntimeMeta* types in favor of the Meta* types they were duplicated from
    • Remove the future.v7_partialHydration flag (#​11725)
      • This also removes the <RouterProvider fallbackElement> prop
        • To migrate, move the fallbackElement to a hydrateFallbackElement/HydrateFallback on your root route
      • Also worth nothing there is a related breaking changer with this future flag:
        • Without future.v7_partialHydration (when using fallbackElement), state.navigation was populated during the initial load
        • With future.v7_partialHydration, state.navigation remains in an "idle" state during the initial load
  • Remove v7_relativeSplatPath future flag (#​11695)

  • Drop support for Node 18, update minimum Node vestion to 20 (#​12171)

    • Remove installGlobals() as this should no longer be necessary
  • Remove remaining future flags (#​11820)

    • React Router v7_skipActionErrorRevalidation
    • Remix v3_fetcherPersist, v3_relativeSplatPath, v3_throwAbortReason
  • rename createRemixStub to createRoutesStub (#​11692)

  • Remove @remix-run/router deprecated detectErrorBoundary option in favor of mapRouteProperties (#​11751)

  • Add react-router/dom subpath export to properly enable react-dom as an optional peerDependency (#​11851)

    • This ensures that we don't blindly import ReactDOM from "react-dom" in <RouterProvider> in order to access ReactDOM.flushSync(), since that would break createMemoryRouter use cases in non-DOM environments
    • DOM environments should import from react-router/dom to get the proper component that makes ReactDOM.flushSync() available:
      • If you are using the Vite plugin, use this in your entry.client.tsx:
        • import { HydratedRouter } from 'react-router/dom'
      • If you are not using the Vite plugin and are manually calling createBrowserRouter/createHashRouter:
        • import { RouterProvider } from "react-router/dom"
  • Remove future.v7_fetcherPersist flag (#​11731)

  • Update cookie dependency to ^1.0.1 - please see the release notes for any breaking changes (#​12172)

Minor Changes
    • Add support for prerender config in the React Router vite plugin, to support existing SSG use-cases (#​11539)
      • You can use the prerender config to pre-render your .html and .data files at build time and then serve them statically at runtime (either from a running server or a CDN)
      • prerender can either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc.
    // react-router.config.ts
    import type { Config } from "@react-router/dev/config";
    
    export default {
      async prerender() {
        let slugs = await fakeGetSlugsFromCms();
        // Prerender these paths into `.html` files at build time, and `.data`
        // files if they have loaders
        return ["/", "/about", ...slugs.map((slug) => `/product/${slug}`)];
      },
    } satisfies Config;
    
    async function fakeGetSlugsFromCms() {
      await new Promise((r) => setTimeout(r, 1000));
      return ["shirt", "hat"];
    }
    
  • Params, loader data, and action data as props for route component exports (#​11961)

    export default function Component({ params, loaderData, actionData }) {}
    
    export function HydrateFallback({ params }) {}
    export function ErrorBoundary({ params, loaderData, actionData }) {}
    
  • Remove duplicate RouterProvider impliementations (#​11679)

  • Typesafety improvements (#​12019)

    React Router now generates types for each of your route modules.
    You can access those types by importing them from ./+types.<route filename without extension>.
    For example:

    // app/routes/product.tsx
    import type * as Route from "./+types.product";
    
    export function loader({ params }: Route.LoaderArgs) {}
    
    export default function Component({ loaderData }: Route.ComponentProps) {}
    

    This initial implementation targets type inference for:

    • Params : Path parameters from your routing config in routes.ts including file-based routing
    • LoaderData : Loader data from loader and/or clientLoader within your route module
    • ActionData : Action data from action and/or clientAction within your route module

    In the future, we plan to add types for the rest of the route module exports: meta, links, headers, shouldRevalidate, etc.
    We also plan to generate types for typesafe Links:

    <Link to="/products/:id" params={{ id: 1 }} />
    //        ^^^^^^^^^^^^^          ^^^^^^^^^
    // typesafe `to` and `params` based on the available routes in your app
    

    Check out our docs for more:

  • Stabilize unstable_dataStrategy (#​11969)

  • Stabilize unstable_patchRoutesOnNavigation (#​11970)

Patch Changes

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate CLI.

This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [react-router](https://github.com/remix-run/react-router) ([source](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router)) | [`^6.30.6` → `^8.0.0`](https://renovatebot.com/diffs/npm/react-router/6.30.6/8.5.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/react-router/8.5.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-router/6.30.6/8.5.2?slim=true) | --- ### React Router: Arbitrary Constructor Injection via deserializeErrors() in React Router SSR Hydration [CVE-2026-53666](https://nvd.nist.gov/vuln/detail/CVE-2026-53666) / [GHSA-337j-9hxr-rhxg](https://github.com/advisories/GHSA-337j-9hxr-rhxg) <details> <summary>More information</summary> #### Details If application code allows attacker supplied input to overwrite certain aspects of errors caught by the SSR process, then it was possible for attacker to trigger unexpected constructor execution on the client which would trigger outbound network traffic. This is only possible with very specific (and unlikely) application layer code. > [!NOTE] > This does not impact your application if you are using Declarative Mode. This only impacts Framework Mode and Data Mode applications doing manual SSR/hydration #### Severity - CVSS Score: 6.1 / 10 (Medium) - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N` #### References - [https://github.com/remix-run/react-router/security/advisories/GHSA-337j-9hxr-rhxg](https://github.com/remix-run/react-router/security/advisories/GHSA-337j-9hxr-rhxg) - [https://github.com/remix-run/react-router/pull/15175](https://github.com/remix-run/react-router/pull/15175) - [https://github.com/remix-run/react-router/commit/9d22943fd46c8ae4b08236425fa3549e10e9ad1a](https://github.com/remix-run/react-router/commit/9d22943fd46c8ae4b08236425fa3549e10e9ad1a) - [https://github.com/remix-run/react-router](https://github.com/remix-run/react-router) - [https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v7180](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v7180) - [https://github.com/remix-run/react-router/releases/tag/react-router@7.18.0](https://github.com/remix-run/react-router/releases/tag/react-router@7.18.0) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-337j-9hxr-rhxg) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### React Router: Open redirect via backslash in <Link> and useNavigate (CVE-2025-68470 bypass) [CVE-2026-53669](https://nvd.nist.gov/vuln/detail/CVE-2026-53669) / [GHSA-wrjc-x8rr-h8h6](https://github.com/advisories/GHSA-wrjc-x8rr-h8h6) <details> <summary>More information</summary> #### Details This is a follow up to [CVE-2025-68470](https://github.com/remix-run/react-router/security/advisories/GHSA-9jcx-v3wj-wh4m). React Router was alerted to certain scenarios in which the fix there was incomplete so there still existed some scenarios where attacker supplied paths passed to navigation mechanisms could result in unexpected external navigations. #### Severity - CVSS Score: 5.1 / 10 (Medium) - Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N` #### References - [https://github.com/remix-run/react-router/security/advisories/GHSA-wrjc-x8rr-h8h6](https://github.com/remix-run/react-router/security/advisories/GHSA-wrjc-x8rr-h8h6) - [https://github.com/remix-run/react-router/pull/15176](https://github.com/remix-run/react-router/pull/15176) - [https://github.com/remix-run/react-router](https://github.com/remix-run/react-router) - [https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v7180](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md#v7180) - [https://github.com/remix-run/react-router/releases/tag/react-router@7.18.0](https://github.com/remix-run/react-router/releases/tag/react-router@7.18.0) - [http://github.com/remix-run/react-router/pull/15176](http://github.com/remix-run/react-router/pull/15176) This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-wrjc-x8rr-h8h6) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)). </details> --- ### Release Notes <details> <summary>remix-run/react-router (react-router)</summary> ### [`v8.5.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v852) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.5.1...react-router@8.5.2) ##### Patch Changes - Keep navigation metadata consistent after a submission action throws an error ([#&#8203;15621](https://github.com/remix-run/react-router/pull/15621)) - Use the committed history action for loader `dataStrategy` navigation types and loading navigation history actions - Cancel the discarded response body for `HEAD` requests, so a resource route streaming a file no longer leaks its file descriptor ([#&#8203;15634](https://github.com/remix-run/react-router/pull/15634)) - Keep observing nested deferred promise rejections after cancelling a data response so they cannot crash the server - Preserve streamed `<Suspense>` boundaries during hydration in development ([#&#8203;15382](https://github.com/remix-run/react-router/pull/15382)) - Wrap the critical CSS reset in `React.startTransition` to prevent React 19 from silently discarding the server HTML and rendering the boundary on the client - Fix submissions to root form actions containing search parameters or a hash when a `basename` is configured ([#&#8203;15725](https://github.com/remix-run/react-router/pull/15725)) - Fix `href()` to throw for `null` required parameters and omit `null` splat parameters without a trailing slash, matching the behavior for `undefined` and the defined types ([#&#8203;15754](https://github.com/remix-run/react-router/pull/15754)) - Fix generated `MetaArgs.matches` types to stop at the current route instead of appending an unknown, possibly undefined tail ([#&#8203;15697](https://github.com/remix-run/react-router/pull/15697)) - Improve path generation and URL validation across `href()`, `generatePath()`, links, forms, fetchers, and redirects ([#&#8203;15785](https://github.com/remix-run/react-router/pull/15785)) - Stop `redirect()`, `redirectDocument()` and `replace()` from setting `status: 302` on the `ResponseInit` passed to them ([#&#8203;15753](https://github.com/remix-run/react-router/pull/15753)) - Later responses created from the same init object no longer get status 302, and a frozen init no longer throws - Clear an `<Await>` render error when it receives a new `resolve` value, so the error element no longer stays on screen after navigating to a route whose data renders fine ([#&#8203;15695](https://github.com/remix-run/react-router/pull/15695)) - Run `clientMiddleware` during RSC client navigations and preserve it when route components update via HMR ([#&#8203;15763](https://github.com/remix-run/react-router/pull/15763)) - Handle `HEAD` resource responses consistently in RSC Framework and RSC Data modes ([#&#8203;15783](https://github.com/remix-run/react-router/pull/15783)) - Fix initial rendering of RSC routes with a `clientLoader` and no `HydrateFallback` ([#&#8203;15763](https://github.com/remix-run/react-router/pull/15763)) - Fix `<ScrollRestoration>` throwing an uncaught error before hydration when `sessionStorage` is unavailable ([#&#8203;15566](https://github.com/remix-run/react-router/pull/15566)) - The inline restore script already logged the storage error, but its cleanup call accessed `sessionStorage` again and threw (e.g. Chrome with "Block all cookies", sandboxed cross-origin iframes) - The error is still logged with `console.error`; only the second, uncaught throw is removed - Fix `useBlocker` leaving behind a stale blocker that keeps blocking navigation after its component is hidden and shown again with `<Activity>`, or after the router is recreated ([#&#8203;15710](https://github.com/remix-run/react-router/pull/15710)) ### [`v8.5.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v851) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.5.0...react-router@8.5.1) ##### Patch Changes - Fix `URIError: URI malformed` when an `ssr: false` dev server receives a URL path with a malformed percent-encoding ([#&#8203;15649](https://github.com/remix-run/react-router/pull/15649)) - Bound server route manifest processing for paths with expensive route expansion ([#&#8203;15703](https://github.com/remix-run/react-router/pull/15703)) - Fall back to initial route discovery during server rendering and RSC document/data requests - Account for the number and depth of candidate branches when using regex matching - Encode commas within paths sent to the lazy route discovery manifest endpoint so routes with commas in their paths are discovered correctly ([#&#8203;15640](https://github.com/remix-run/react-router/pull/15640)) - Fix fetcher revalidation errors bubbling to the root error boundary instead of the nearest boundary above the route that owns the fetcher ([#&#8203;15676](https://github.com/remix-run/react-router/pull/15676)) - Avoid duplicate history entries when posting a `<Form>` to the current URL with an encoded `action` ([#&#8203;15679](https://github.com/remix-run/react-router/pull/15679)) - Replace the current history entry when the `action` contains characters that get percent-encoded, such as spaces or non-ASCII characters - Fix an unhandled promise rejection when the browser skips a `viewTransition` navigation, for example in a hidden tab ([#&#8203;15582](https://github.com/remix-run/react-router/pull/15582)) - Bubble rejected `lazy.Component` imports on loader-less routes to the nearest error boundary ([#&#8203;15658](https://github.com/remix-run/react-router/pull/15658)) - Render the error boundary instead of a blank page - Preserve pending fetcher mutation revalidation when an older navigation or background reload completes to prevent stale loader data ([#&#8203;15686](https://github.com/remix-run/react-router/pull/15686)) - Keep newer fetcher loads cancellable and preserve them when earlier revalidations finish or abort, preventing older responses from overwriting fresh fetcher data - Retry rejected `lazy` route imports instead of caching failures permanently ([#&#8203;15689](https://github.com/remix-run/react-router/pull/15689)) - Revalidate loader data when a fetcher action redirect is not followed ([#&#8203;15557](https://github.com/remix-run/react-router/pull/15557)) - Revalidate when an action redirect is ignored because a newer navigation started or the fetcher unmounted while the action was running - Include shared parent loaders when another navigation completed while the action was running - Continue to respect `shouldRevalidate` - Return fetchers to `idle` when a revalidation completes a pending navigation started by another fetcher's redirect - Avoid adding an incompatible `document.startViewTransition()` overload to the global `Document` type ([#&#8203;15680](https://github.com/remix-run/react-router/pull/15680)) - Allow transition results to be assigned to the DOM `ViewTransition` type - Skip `deleteData` in `destroySession` when the session has no ID ([#&#8203;15639](https://github.com/remix-run/react-router/pull/15639)) - Avoid failures when destroying a session without a cookie on storage that rejects an empty key - Surface the host's 404 response when a SPA fallback route has no prerendered data ([#&#8203;15646](https://github.com/remix-run/react-router/pull/15646)) - Request single-fetch `.data` files for hydrating routes with a server `loader` in an `ssr: false` app with a `prerender` config - Avoid the internal "No result found for routeId" error for non-prerendered parameterized paths served via the SPA fallback - Improve turbo-stream decoding validation and object property handling ([18e1fbd](https://github.com/remix-run/react-router/commit/18e1fbd)) ##### Unstable Changes ⚠️ *[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use* - Add an opt-in `<Await unstable_promise={promise}>` implementation based on React's `use()` API ([#&#8203;15678](https://github.com/remix-run/react-router/pull/15678)) - Use `React.use` instead of React Router's internal promise tracking - Accept promise-like values and retain `errorElement`, `useAsyncValue`, and `useAsyncError` support - Handle only promise rejections with `errorElement` when using `unstable_promise`, allowing child render errors to bubble to the nearest React error boundary - Track streamed promises during decoding so settled server content stays visible during hydration updates with either Await API or direct `React.use()` - Fix `URIError: URI malformed` when an API-only (`ssr: "unstable_api-only"`) server receives a URL path with a malformed percent-encoding ([#&#8203;15649](https://github.com/remix-run/react-router/pull/15649)) - Fix duplicate headers when throwing a redirect from an RSC server function ([#&#8203;15667](https://github.com/remix-run/react-router/pull/15667)) ### [`v8.5.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v850) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.4.0...react-router@8.5.0) ##### Minor Changes - Deprecate React Router's view transition APIs in favor of React's `<ViewTransition>` component, available in React 19.3 and later ([#&#8203;15493](https://github.com/remix-run/react-router/pull/15493)) - Deprecate the `viewTransition` props/options, `useViewTransitionState`, and `NavLink`'s `isTransitioning` render prop and `transitioning` class - Preserve existing behavior, including support for older React versions - See the [migration guide](https://reactrouter.com/how-to/view-transitions) for a navigation example and compatibility considerations ##### Patch Changes - Fix `<Await>` failing to server render promises decoded from an RSC payload, which caused the Suspense boundary to switch to client rendering ([#&#8203;15597](https://github.com/remix-run/react-router/pull/15597)) - Declare `@types/react` and `@types/react-dom` as optional peer dependencies so the shipped type definitions resolve React types under strict (non-hoisted) node_modules layouts ([#&#8203;15528](https://github.com/remix-run/react-router/pull/15528)) - Fix the `unstable_useRouterState` documentation example to call the imported alias ([#&#8203;15535](https://github.com/remix-run/react-router/pull/15535)) - Render the `HydrateFallback` of a route discovered through `patchRoutesOnNavigation` during initial hydration ([#&#8203;15537](https://github.com/remix-run/react-router/pull/15537)) - Routes discovered during initial hydration are now exposed in `state.matches` while their loaders run, so `<RouterProvider>` renders down to the discovered route's `HydrateFallback` instead of rendering nothing - Fix router state recovery when updates occur before `RouterProvider` subscribes, including when other subscribers are already attached, and report current client errors once without replaying server errors during hydration ([#&#8203;15637](https://github.com/remix-run/react-router/pull/15637)) - Fix `matchPath` not treating a static segment as optional when it contains characters outside `[\w-]` ([#&#8203;15425](https://github.com/remix-run/react-router/pull/15425)) - Fix an RSC server crash when a client aborts a document request while the HTML stream waits for the RSC payload ([#&#8203;15612](https://github.com/remix-run/react-router/pull/15612)) - Stop revalidating a fetcher after `fetcher.reset()`, so its cleared data no longer comes back on the next revalidation ([#&#8203;15633](https://github.com/remix-run/react-router/pull/15633)) ##### Unstable Changes ⚠️ *[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use* - Add an `unstable_fetch` prop to `<HydratedRouter>` to customize JavaScript-issued manifest and server data requests in conventional Framework Mode ([#&#8203;15586](https://github.com/remix-run/react-router/pull/15586)) - The function receives the intended request as well as context identifying the type of request - Data request context includes `navigationType` (`"PUSH"`, `"REPLACE"`, or `"POP"` for navigation-initiated requests, including reloaded fetchers; `null` otherwise) - Data strategies receive equivalent metadata through `unstable_initiator` and `unstable_navigationType` - The custom fetch context is a discriminated union, so narrowing `type` to `"navigation"` guarantees a non-null `navigationType`, while other data requests have a `null` `navigationType` - Fetchers reloaded after an initialization redirect retain the `"initialization"` type and include their fetcher key - Like other router initialization options, the implementation is captured when the singleton router is created and thus subsequent prop changes are ignored - Browser-managed data prefetches from `<Link prefetch>` use native `<link rel="prefetch">` elements and do not call the custom implementation - Use the callback for custom fetch options, custom headers, safe request retries, or response header inspection - Return response bodies unchanged so React Router can decode its manifest and Turbo Stream data protocols - Support API-only Framework Mode with runtime server data loading, actions, revalidation, and lazy route discovery ([#&#8203;15601](https://github.com/remix-run/react-router/pull/15601)) - Hydrate prerendered pages from build-time data and fetch server loader data when hydrating a SPA fallback - Preserve normal loader revalidation and server-action support for eagerly loaded and lazily discovered routes, and honor loader opt-outs when making server data requests - Add `unstable_useRouteDiscovery` for application-controlled route discovery in conventional Framework Mode ([#&#8203;15602](https://github.com/remix-run/react-router/pull/15602)) - Discover selected destinations or load the running client's full route manifest without loading route modules - Compose manifest-mismatch handlers, with shared recovery and cancellation that preserves application state - Keep full-manifest failures catchable without rendering error boundaries, whether mismatch handlers use the hook or event's `loadAllRoutes()` - Cancel pending revalidation alongside a canceled navigation, retaining existing data and settling interrupted fetchers before restoring Back/Forward history - Enable `future.unstable_customRouteDiscovery` to opt in - Apps without the flag retain existing discovery behavior - Call `event.defaultBehavior()` from a custom mismatch handler to explicitly run built-in recovery - Return middleware short-circuit responses as-is for document requests in RSC modes, including resource routes, instead of decoding non-RSC bodies as Flight ([#&#8203;15628](https://github.com/remix-run/react-router/pull/15628)) - Include server middleware in both eager and lazy RSC route configuration types - Preserve HTML rendering for cached Flight responses returned by middleware, and pass through raw responses that replace the result of `next()` ### [`v8.4.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v840) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.3.1...react-router@8.4.0) ##### Minor Changes - Deprecate the `createStaticRouter({ branches })` option ([#&#8203;15297](https://github.com/remix-run/react-router/pull/15297)) - `createStaticRouter` now caches route branches internally, ignores `branches`, and logs a deprecation warning when the option is provided - The deprecated `EntryContext.branches` property remains available for compatibility but is always an empty array ##### Patch Changes - Prevent stale route discovery during manifest version-mismatch recovery ([#&#8203;15489](https://github.com/remix-run/react-router/pull/15489)) - Keep concurrent manifest responses pending while a document reload is in progress - Report a discovery error when a previous reload failed to resolve a version mismatch instead of loading a stale route or reloading repeatedly - Fail pending requests if a document reload does not complete within five seconds or the document is restored from the back-forward cache, allowing subsequent requests to recover - Preserve lazy route module import errors during SPA navigations instead of replacing them with a missing `dataStrategy` result error ([#&#8203;15464](https://github.com/remix-run/react-router/pull/15464)) - Switch to more granular internal router contexts to avoid unnecessary route component re-renders when unrelated data router state changes ([#&#8203;15376](https://github.com/remix-run/react-router/pull/15376)) - ⚠️ This contains some breaking changes to exported `UNSAFE_` contexts, so please review carefully if you are using those unsafe exports - Correctly escape streamed RSC redirect locations in meta tag attributes ([#&#8203;15491](https://github.com/remix-run/react-router/pull/15491)) - Avoid unintended `document.startViewTransition` calls during initial hydration and `router.revalidate()` calls ([#&#8203;15484](https://github.com/remix-run/react-router/pull/15484)) - Fix `SingleFetchNoResultError` thrown when a fetcher revalidates against a splat route during lazy route discovery ([#&#8203;15395](https://github.com/remix-run/react-router/pull/15395)) - Track discovery per fetcher load so revalidation waits for the current load's discovery, even when the fetcher key is reused, while still restarting interrupted loaders after discovery completes - Preserve the underlying decode failure as the `cause` of the `Unable to decode turbo-stream response` error ([#&#8203;15450](https://github.com/remix-run/react-router/pull/15450)) ##### Unstable Changes ⚠️ *[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use* - Add a Data Mode `future.unstable_routePatternMatching` flag for more efficient route matching powered by `@remix-run/route-pattern` ([#&#8203;15298](https://github.com/remix-run/react-router/pull/15298)) - Add an `unstable_validateParams` route field to reject invalid parameter values and continue matching - Document access control requirements for RSC Server Functions ([#&#8203;15490](https://github.com/remix-run/react-router/pull/15490)) - Treat every Server Function as a public endpoint that must perform all of its own access control checks - Recommend route actions when access control should be provided by route middleware ### [`v8.3.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v831) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.3.0...react-router@8.3.1) ##### Patch Changes - Fix `Expected fetcher: <key>` error thrown on navigation when a fetcher is aborted during its post-action revalidation ([#&#8203;15365](https://github.com/remix-run/react-router/pull/15365)) - Fix lazy route discovery caching a path as discovered when the triggering navigation was aborted after the manifest response settled but before the route tree was patched, which permanently (for the session) shadowed the real route behind a catch-all or produced 404s on every subsequent visit ([#&#8203;15399](https://github.com/remix-run/react-router/pull/15399)) - Improve route matching performance for long paths ([#&#8203;15417](https://github.com/remix-run/react-router/pull/15417)) - Improve validation of action request origins ([#&#8203;15419](https://github.com/remix-run/react-router/pull/15419)) - Fix `<ScrollRestoration>` leaving `history.scrollRestoration` set to `"auto"` after a bfcache restore, which let the browser restore scroll on subsequent history traversals before the destination route had rendered ([#&#8203;15397](https://github.com/remix-run/react-router/pull/15397)) - Properly respect the `relative` option in `useSubmit`/`fetcher.submit` when resolivng the `action` path ([#&#8203;15400](https://github.com/remix-run/react-router/pull/15400)) - Add additional URL validation on client side navigations/redirects ([#&#8203;15445](https://github.com/remix-run/react-router/pull/15445)) ### [`v8.3.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v830) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.2.0...react-router@8.3.0) ##### Patch Changes - Encode path params in `href`/`generatePath` per RFC 3986 path-segment rules instead of `encodeURIComponent` ([#&#8203;15310](https://github.com/remix-run/react-router/pull/15310)) - Characters that are valid literally in a path segment (`$ & + , ; = : @` — RFC 3986 `pchar`) are no longer percent-encoded, so values like a semver build `1.0.0+1` interpolate unchanged instead of becoming `1.0.0%2B1` - Structural/unsafe characters (`/ ? # %`, whitespace, non-ASCII) are still escaped exactly as before - Use `crypto.randomUUID()` for `createMemorySessionStorage` session ids ([#&#8203;15302](https://github.com/remix-run/react-router/pull/15302)) - `createMemorySessionStorage` is only intended for local development and testing - sessions are lost when the server restarts - Fix `NavLink` not applying its `pending` state when `to` has a trailing slash ([#&#8203;15300](https://github.com/remix-run/react-router/pull/15300)) - Preserve RSC route component metadata so routes with a `clientLoader` can skip unnecessary server requests once their components have rendered while still fetching missing server-rendered elements ([#&#8203;15323](https://github.com/remix-run/react-router/pull/15323)) - Harden RSC CSRF code paths ([#&#8203;15311](https://github.com/remix-run/react-router/pull/15311)) - Fix server crash (`TypeError: Invalid state: Unable to enqueue`) when a request is aborted while the RSC HTML stream has a pending flush ([#&#8203;15286](https://github.com/remix-run/react-router/pull/15286)) - Handle cancellation of the `injectRSCPayload` readable side, clear the pending flush, and cancel the underlying RSC payload stream ##### Unstable Changes ⚠️ *[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use* - Detect stale RSC clients during lazy route discovery and reload the destination document ([#&#8203;15318](https://github.com/remix-run/react-router/pull/15318)) ##### Migration Apps using the default RSC Framework entry do not need to make any changes. Apps with a custom `entry.rsc.tsx` should import the generated client version and pass it to `unstable_matchRSCServerRequest`: ```tsx import clientVersion from "virtual:react-router/unstable_rsc/client-version"; return unstable_matchRSCServerRequest({ // ... clientVersion, }); ``` - Add CSP nonce support to RSC document rendering ([#&#8203;15320](https://github.com/remix-run/react-router/pull/15320)) - Add `nonce` options to `unstable_routeRSCServerRequest` and `unstable_RSCStaticRouter` - Forward the nonce to the HTML renderer and apply it to injected RSC payload scripts and nonce-aware framework components To adopt nonce-based CSP, update your `entry.ssr.tsx` (run `react-router reveal entry.ssr` first in RSC Framework Mode) to generate a fresh nonce for each request. Pass it to `routeRSCServerRequest`, spread the `renderHTML` options into React's HTML renderer, pass `options.nonce` to `RSCStaticRouter`, and use the same nonce in the `Content-Security-Policy` response header: ```tsx const nonce = crypto.randomUUID(); const response = await routeRSCServerRequest({ request, serverResponse, createFromReadableStream, nonce, async renderHTML(getPayload, options) { const payload = getPayload(); return renderHTMLToReadableStream( <RSCStaticRouter getPayload={getPayload} nonce={options.nonce} />, { ...options, bootstrapScriptContent, formState: await payload.formState, signal: request.signal, }, ); }, }); response.headers.set( "Content-Security-Policy", `script-src 'self' 'nonce-${nonce}'`, ); ``` ### [`v8.2.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v820) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.1.0...react-router@8.2.0) ##### Patch Changes - Fix `href()` to properly stringify and URL-encode param values, matching `generatePath()` ([#&#8203;15277](https://github.com/remix-run/react-router/pull/15277)) - splat params preserve path separators while encoding each segment individually - Fix dynamic param extraction for routes with optional static segments ([#&#8203;15200](https://github.com/remix-run/react-router/pull/15200)) - When a route path contains optional static segments (e.g. `/school?/user/:id`), the internal regex's incorrectly shifted parameter indices resulting in incorrect parameter extraction - Consecutive optional static segments (e.g. `/one?/two?`) were only partially handled - Preserve navigation blocker state through a revalidation ([#&#8203;15246](https://github.com/remix-run/react-router/pull/15246)) - Fix route ranking for dynamic parameters with static extension suffixes ([#&#8203;15273](https://github.com/remix-run/react-router/pull/15273)) - These were not being detected as dynamic param segments and instead got incorrectly scored higher as a static segment - This meant they could potentially tie truly static routes like `/sitemap.xml` and outrank them based on definition order - These are now correctly identified as dynamic parameter segments and scored correctly - Use ReactFormState types instead of unknown ([#&#8203;15263](https://github.com/remix-run/react-router/pull/15263)) ### [`v8.1.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v810) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.0.1...react-router@8.1.0) ##### Minor Changes - Return route metadata from server request, client navigation, and client fetcher instrumentations ([#&#8203;15235](https://github.com/remix-run/react-router/pull/15235)) - Adds result metadata after instrumented calls complete, including the URL, matched route pattern, and params - Adds known HTTP status codes to server request handler instrumentation results ### [`v8.0.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v801) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@8.0.0...react-router@8.0.1) ##### Patch Changes - Remove the obsolete `AppLoadContext` type export accidentally left over from v7 now that middleware is always enabled and server request context is provided through `RouterContextProvider`. ([#&#8203;15207](https://github.com/remix-run/react-router/pull/15207)) ### [`v8.0.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v800) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.6...react-router@8.0.0) ##### Major Changes - Remove the `future.v8_trailingSlashAwareDataRequests` flag ([#&#8203;15100](https://github.com/remix-run/react-router/pull/15100)) - Trailing slash-aware data request URLs are now the default behavior. - Update `tsconfig.json` `target`/`lib` from `ES2020 -> ES2022` ([591853e](https://github.com/remix-run/react-router/commit/591853e)) - Switch the published packages in `packages/` to ESM-only. ([#&#8203;14895](https://github.com/remix-run/react-router/pull/14895)) ([59ebcf1](https://github.com/remix-run/react-router/commit/59ebcf1)) - Remove deprecated `data` parameter in favor of `loaderData` for `meta` APIs (to align with `Route.ComponentProps`) ([#&#8203;14931](https://github.com/remix-run/react-router/pull/14931)) - `Route.MetaArgs`, `Route.MetaMatch`, `MetaArgs`, `MetaMatch`, `Route.ComponentProps.matches`, `UIMatch` - Remove `future.v8_passThroughRequests` flag - the raw incoming `request` is now always passed through to `loader`/`action`. Use `url` for the normalized URL without React Router-specific implementation details (`.data` suffixes, `index`/`_routes` search params). ([#&#8203;15079](https://github.com/remix-run/react-router/pull/15079)) - Remove internal `hasErrorBoundary` field added to `router.routes` when using a data router ([#&#8203;15074](https://github.com/remix-run/react-router/pull/15074)) - This should not impact user-facing code since this was an internal prop and was computed based on the presence of `ErrorBoundary` or `errorElement` on your route - `hasErrorBoundary` is no longer accepted on `RouteObject` (`IndexRouteObject`/`NonIndexRouteObject`), `DataRouteObject`, `<Route>` JSX props, or as a key in `lazy` route definitions. - The `MapRoutePropertiesFunction` signature no longer requires returning `hasErrorBoundary`; the router infers it directly. - Remove `react-router-dom` package ([#&#8203;15076](https://github.com/remix-run/react-router/pull/15076)) - In v7 everything DOM-specific was collapsed into `react-router/dom` - `react-router-dom` was kept around as a convenience so existing v6 app imports would still work - For v8, you will need to swap `react-router-dom` imports: - `RouterProvider`/`HydratedRouter` should be imported from `react-router/dom` - Everything else should be imported from `react-router` - Remove `future.v8_middleware` flag — middleware is always enabled in v8 ([#&#8203;15078](https://github.com/remix-run/react-router/pull/15078)) - The `future.v8_middleware` flag has been removed; middleware is now always enabled - The `context` parameter passed to `loader`, `action`, and `middleware` functions is always a `RouterContextProvider` instance - `getLoadContext` functions in custom servers must return a `RouterContextProvider` — returning a plain object is no longer supported - The `MiddlewareEnabled` type (previously exported as `UNSAFE_MiddlewareEnabled`) has been removed since the conditional it gated is now unconditional - The `Future` module augmentation pattern (`interface Future { v8_middleware: true }`) is no longer needed to type `context` in Data Mode - Update minimum Node version to 22.22.0 ([#&#8203;14928](https://github.com/remix-run/react-router/pull/14928)) - Update minimum React version to 19.2.7 ([#&#8203;15062](https://github.com/remix-run/react-router/pull/15062)) ##### Minor Changes - Bump dependencies ([#&#8203;15080](https://github.com/remix-run/react-router/pull/15080)) - Bumped `cookie` from `^1.0.1` to `^1.1.1` - Bumped `set-cookie-parser` from `^2.6.0` to `^3.1.0` ##### Patch Changes - Ensure client middleware errors load lazy route error boundaries before bubbling ([#&#8203;15086](https://github.com/remix-run/react-router/pull/15086)) - Remove explicit `onSubmit` type override from `SharedFormProps` to fix deprecation warning with `@types/react@19.x` ([#&#8203;14932](https://github.com/remix-run/react-router/pull/14932)) ([59ebcf1](https://github.com/remix-run/react-router/commit/59ebcf1)) - Update package builds to preserve individual module files in published artifacts. Public APIs and documented import paths are unchanged. ([#&#8203;15092](https://github.com/remix-run/react-router/pull/15092)) - Updated package TypeScript configs to support modern module syntax used by the build configuration. - Migrate package builds from `tsup` to `tsdown`. Published package entry points and public APIs are unchanged. ([#&#8203;15092](https://github.com/remix-run/react-router/pull/15092)) - Upgrade React Router's TypeScript tooling to TypeScript 6. Runtime behavior and public APIs are unchanged. ([#&#8203;15092](https://github.com/remix-run/react-router/pull/15092)) ### [`v7.18.6`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.6): v7.18.6 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.5...react-router@7.18.6) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7186> ### [`v7.18.5`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.5): v7.18.5 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.4...react-router@7.18.5) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7185> ### [`v7.18.4`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.4): v7.18.4 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.3...react-router@7.18.4) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7184> ### [`v7.18.3`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.3): v7.18.3 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.2...react-router@7.18.3) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7183> ### [`v7.18.2`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.2): v7.18.2 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.1...react-router@7.18.2) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7182> ### [`v7.18.1`](https://github.com/remix-run/react-router/releases/tag/react-router%407.18.1): v7.18.1 [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.18.0...react-router@7.18.1) See the changelog for release notes: <https://github.com/remix-run/react-router/blob/v7/CHANGELOG.md#v7181> ### [`v7.18.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7180) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.17.0...react-router@7.18.0) ##### Patch Changes - Fix server handler prerender responses when using `ssr: false` and `future.v8_trailingSlashAwareDataRequests: true`. Avoids false positive "SPA Mode" detection when serving prerendered paths ([#&#8203;15173](https://github.com/remix-run/react-router/pull/15173)) - Use the `ServerRouter` nonce for nonce-aware SSR components when they don't provide their own value so strict CSP pages can load them. ([#&#8203;15170](https://github.com/remix-run/react-router/pull/15170)) - Use `turbo-stream` to serialize and deserialize Framework Mode hydration errors ([#&#8203;15175](https://github.com/remix-run/react-router/pull/15175)) - Precompute route branch matchers to avoid recompiling route path regexes during matching ([#&#8203;15186](https://github.com/remix-run/react-router/pull/15186)) - Use the constructed request URL host when validating action request origins. ([#&#8203;15185](https://github.com/remix-run/react-router/pull/15185)) - Remove the un-documented custom error serialization logic from Data Mode SSR built-in hydration flows ([#&#8203;15175](https://github.com/remix-run/react-router/pull/15175)) - Validate protocols in RSC render redirects ([#&#8203;15177](https://github.com/remix-run/react-router/pull/15177)) - Consolidate url normalization logic and better handle mixed slashes ([#&#8203;15176](https://github.com/remix-run/react-router/pull/15176)) ### [`v7.17.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7170) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.16.0...react-router@7.17.0) ##### Minor Changes - Ship a subset of the official documentation inside the `react-router` package ([#&#8203;15121](https://github.com/remix-run/react-router/pull/15121)) - Markdown docs are now available in `node_modules/react-router/docs`, letting AI coding agents and the React Router agent skills read official docs locally - Excludes auto-generated API docs (`api/`), `community/` content, and tutorials (`tutorials/`) ### [`v7.16.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7160) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.15.1...react-router@7.16.0) ##### Minor Changes - Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#&#8203;15098](https://github.com/remix-run/react-router/pull/15098)) ##### Patch Changes - Disable manifest path when lazy route dicovery is disabled ([#&#8203;15068](https://github.com/remix-run/react-router/pull/15068)) - Fix browser URL creation to use the configured history window instead of the global window. ([#&#8203;15066](https://github.com/remix-run/react-router/pull/15066)) - Pass the history/router window through to `createBrowserURLImpl` so custom window contexts keep the correct URL origin. - Fix `useNavigation()` return type to preserve discriminated union across navigation states ([#&#8203;15095](https://github.com/remix-run/react-router/pull/15095)) - Widen `MetaDescriptor` `script:ld+json` type from `LdJsonObject` to `LdJsonObject | LdJsonObject[]` to permit multiple JSON-LD schemas in a single `<script type="application/ld+json">` tag emitted by `<Meta />` ([#&#8203;15082](https://github.com/remix-run/react-router/pull/15082)) ### [`v7.15.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7151) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.15.0...react-router@7.15.1) ##### Patch Changes - Update router to operate on fetcher Maps in an immutable manner to avoid delayed React renders from potentially reading an updated but not yet committed Map. This could result in brief flickers in some fetcher-driven optimistic UI scenarios. ([#&#8203;15028](https://github.com/remix-run/react-router/pull/15028)) - Fix `serverLoader()` returning stale SSR data when a client navigation aborts pending hydration before the hydration `clientLoader` resolves ([#&#8203;15022](https://github.com/remix-run/react-router/pull/15022)) - Fix `RouterProvider` `onError` callback not being called for synchronous initial loader errors in SPA mode ([#&#8203;15039](https://github.com/remix-run/react-router/pull/15039)) ([#&#8203;14942](https://github.com/remix-run/react-router/pull/14942)) - Memoize `useFetchers` to return a stable identity and only change if fetchers changed ([#&#8203;15028](https://github.com/remix-run/react-router/pull/15028)) - Internal refactor to consolidate mutation request detection through shared utility ([#&#8203;15033](https://github.com/remix-run/react-router/pull/15033)) ##### Unstable Changes ⚠️ *[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use* - Add a new `unstable_useRouterState()` hook that consolidates access to active and pending router states (RFC: [#&#8203;12358](https://github.com/remix-run/react-router/issues/12358)) ([#&#8203;15017](https://github.com/remix-run/react-router/pull/15017)) - Data/Framework/RSC only — throws when used without a data router - This should allow you to consolidate usages of the following hooks which will likely be deprecated and removed in a future major version - `useLocation` - `useSearchParams` - `useParams` - `useMatches` - `useNavigationType` - `useNavigation` ```ts let { active, pending } = unstable_useRouterState(); // Active is always populated with the current location active.location; // replaces `useLocation()` active.searchParams; // replaces `useSearchParams()[0]` active.params; // replaces `useParams()` active.matches; // replaces `useMatches()` active.type; // replaces `useNavigationType()` // Pending is only populated during a navigation pending.location; // replaces `useNavigation().location` pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)` pending.params; // Not directly accessible today pending.matches; // Not directly accessible today pending.type; // Not directly accessible today pending.state; // replaces `useNavigation().state` pending.formMethod; // replaces useNavigation().formMethod pending.formAction; // replaces useNavigation().formAction pending.formEncType; // replaces useNavigation().formEncType pending.formData; // replaces useNavigation().formData pending.json; // replaces useNavigation().json pending.text; // replaces useNavigation().text ``` ### [`v7.15.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7150) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.14.2...react-router@7.15.0) ##### Minor Changes - Stabilize `unstable_defaultShouldRevalidate` as `defaultShouldRevalidate` on `<Link>`, `<Form>`, `useLinkClickHandler`, `useSubmit`, `fetcher.submit`, and `setSearchParams` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize the instrumentation APIs. `unstable_instrumentations` is now `instrumentations` and `unstable_pattern` is now `pattern` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - The `unstable_ServerInstrumentation`, `unstable_ClientInstrumentation`, `unstable_InstrumentRequestHandlerFunction`, `unstable_InstrumentRouterFunction`, `unstable_InstrumentRouteFunction`, and `unstable_InstrumentationHandlerResult` types have had their `unstable_` prefixes removed - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize `unstable_mask` as `mask` on `<Link>`, `useLinkClickHandler`, and `useNavigate`, and rename the corresponding `Location.unstable_mask` field to `Location.mask` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize the `unstable_normalizePath` option on `staticHandler.query` and `staticHandler.queryRoute` as `normalizePath` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Remove `unstable_subResourceIntegrity` from the runtime `FutureConfig` type; the flag is now controlled by the top-level `subResourceIntegrity` option in `react-router.config.ts` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize `unstable_url` as `url` on `loader`, `action`, and `middleware` function args ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly - Stabilize `unstable_useTransitions` as `useTransitions` on `<BrowserRouter>`, `<HashRouter>`, `<HistoryRouter>`, `<MemoryRouter>`, `<Router>`, `<RouterProvider>`, `<HydratedRouter>`, and `useLinkClickHandler` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09)) - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly ##### Patch Changes - Add `nonce` to `<Scripts>` `<link rel="modulepreload">` elements (if provided) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b)) - Fix a bug with `unstable_defaultShouldRevalidate={false}` where parent routes that did not export a `shouldRevalidate` function could be incorrectly included in the single fetch call for new child route data ([#&#8203;15012](https://github.com/remix-run/react-router/pull/15012)) - Improve server-side route matching performance by pre-computing flattened/cached route branches ([#&#8203;14967](https://github.com/remix-run/react-router/pull/14967)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b)) - Performance benchmarks showed roughly a 10-15% improvement in server-side request handling performance - Mark `mask` as an optional field in `Location` for easier mocking in unit tests ([#&#8203;14999](https://github.com/remix-run/react-router/pull/14999)) - Cache flattened/ranked route branches to optimize server-side route matching ([#&#8203;14967](https://github.com/remix-run/react-router/pull/14967)) - Improve route matching performance in Framework/Data Mode ([#&#8203;14971](https://github.com/remix-run/react-router/pull/14971)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b)) - Avoiding unnecessary calls to `matchRoutes` in data router scenarios - This includes adding back the optimization that was removed in `7.6.0` ([#&#8203;13562](https://github.com/remix-run/react-router/pull/13562)) - The issues that prompted the revert have been addressed by using the available router `matches` but always updating `match.route` to the latest route in the `manifest` - Leverage pre-computed pre-computing flattened/cached route branches during client side route matching - Performance benchmarks showed roughly a 15-30% improvement in server-side request handling performance ### [`v7.14.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7142) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.14.1...react-router@7.14.2) ##### Patch Changes - Remove the un-documented custom error serialization logic from the internal turbo-stream implementation. React Router only automatically handles serialization of `Error` and it's standard subtypes (`SyntaxError`, `TypeError`, etc.). (\[[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1)) - Properly handle parent middleware redirects during `fetcher.load` (\[[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1)) - Remove redundant `Omit<RouterProviderProps, "flushSync">` from `react-router/dom` `RouterProvider` (\[[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1)) - Improved types for `generatePath`'s `param` arg (\[[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1)) Type errors when required params are omitted: ```ts // Before // Passes type checks, but throws at runtime 💥 generatePath(":required", { required: null }); // After generatePath(":required", { required: null }); // ^^^^^^^^ Type 'null' is not assignable to type 'string'.ts(2322) ``` Allow omission of optional params: ```ts // Before generatePath(":optional?", {}); // ^^ Property 'optional' is missing in type '{}' but required in type '{ optional: string | null | undefined; }'.ts(2741) // After generatePath(":optional?", {}); ``` Allows extra keys: ```ts // Before generatePath(":a", { a: "1", b: "2" }); // ^ Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.ts(2353) // After generatePath(":a", { a: "1", b: "2" }); ``` ### [`v7.14.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#v7141) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.14.0...react-router@7.14.1) ##### Patch Changes - Fix a potential race condition that can occur when rendering a `HydrateFallback` and initial loaders land before the `router.subscribe` call happens in the `RouterProvider` layout effect - Normalize double-slashes in redirect paths ### [`v7.14.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7140) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.13.2...react-router@7.14.0) ##### Patch Changes - UNSTABLE RSC FRAMEWORK MODE BREAKING CHANGE - Existing route module exports remain unchanged from stable v7 non-RSC mode, but new exports are added for RSC mode. If you want to use RSC features, you will need to update your route modules to export the new annotations. ([#&#8203;14901](https://github.com/remix-run/react-router/pull/14901)) If you are using RSC framework mode currently, you will need to update your route modules to the new conventions. The following route module components have their own mutually exclusive server component counterparts: | Server Component Export | Client Component | | ----------------------- | ----------------- | | `ServerComponent` | `default` | | `ServerErrorBoundary` | `ErrorBoundary` | | `ServerLayout` | `Layout` | | `ServerHydrateFallback` | `HydrateFallback` | If you were previously exporting a `ServerComponent`, your `ErrorBoundary`, `Layout`, and `HydrateFallback` were also server components. If you want to keep those as server components, you can rename them and prefix them with `Server`. If you were previously importing the implementations of those components from a client module, you can simply inline them. Example: Before ```tsx import { ErrorBoundary as ClientErrorBoundary } from "./client"; export function ServerComponent() { // ... } export function ErrorBoundary() { return <ClientErrorBoundary />; } export function Layout() { // ... } export function HydrateFallback() { // ... } ``` After ```tsx export function ServerComponent() { // ... } export function ErrorBoundary() { // previous implementation of ClientErrorBoundary, this is now a client component } export function ServerLayout() { // rename previous Layout export to ServerLayout to make it a server component } export function ServerHydrateFallback() { // rename previous HydrateFallback export to ServerHydrateFallback to make it a server component } ``` - rsc Link prefetch ([#&#8203;14902](https://github.com/remix-run/react-router/pull/14902)) - Remove recursion from turbo-stream v2 allowing for encoding / decoding of massive payloads. ([#&#8203;14838](https://github.com/remix-run/react-router/pull/14838)) - encodeViaTurboStream leaked memory via unremoved AbortSignal listener ([#&#8203;14900](https://github.com/remix-run/react-router/pull/14900)) ### [`v7.13.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7132) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.13.1...react-router@7.13.2) ##### Patch Changes - Fix clientLoader.hydrate when an ancestor route is also hydrating a clientLoader ([#&#8203;14835](https://github.com/remix-run/react-router/pull/14835)) - Fix type error when passing Framework Mode route components using `Route.ComponentProps` to `createRoutesStub` ([#&#8203;14892](https://github.com/remix-run/react-router/pull/14892)) - Fix percent encoding in relative path navigation ([#&#8203;14786](https://github.com/remix-run/react-router/pull/14786)) - Add `future.unstable_passThroughRequests` flag ([#&#8203;14775](https://github.com/remix-run/react-router/pull/14775)) By default, React Router normalizes the `request.url` passed to your `loader`, `action`, and `middleware` functions by removing React Router's internal implementation details (`.data` suffixes, `index` + `_routes` query params). Enabling this flag removes that normalization and passes the raw HTTP `request` instance to your handlers. This provides a few benefits: - Reduces server-side overhead by eliminating multiple `new Request()` calls on the critical path - Allows you to distinguish document from data requests in your handlers base don the presence of a `.data` suffix (useful for observability purposes) If you were previously relying on the normalization of `request.url`, you can switch to use the new sibling `unstable_url` parameter which contains a `URL` instance representing the normalized location: ```tsx // ❌ Before: you could assume there was no `.data` suffix in `request.url` export async function loader({ request }: Route.LoaderArgs) { let url = new URL(request.url); if (url.pathname === "/path") { // This check will fail with the flag enabled because the `.data` suffix will // exist on data requests } } // ✅ After: use `unstable_url` for normalized routing logic and `request.url` // for raw routing logic export async function loader({ request, unstable_url }: Route.LoaderArgs) { if (unstable_url.pathname === "/path") { // This will always have the `.data` suffix stripped } // And now you can distinguish between document versus data requests let isDataRequest = new URL(request.url).pathname.endsWith(".data"); } ``` - Internal refactor to consolidate framework-agnostic/React-specific route type layers - no public API changes ([#&#8203;14765](https://github.com/remix-run/react-router/pull/14765)) - Sync protocol validation to rsc flows ([#&#8203;14882](https://github.com/remix-run/react-router/pull/14882)) - Add a new `unstable_url: URL` parameter to route handler methods (`loader`, `action`, `middleware`, etc.) representing the normalized URL the application is navigating to or fetching, with React Router implementation details removed (`.data`suffix, `index`/`_routes` query params) ([#&#8203;14775](https://github.com/remix-run/react-router/pull/14775)) This is being added alongside the new `future.unstable_passthroughRequests` future flag so that users still have a way to access the normalized URL when that flag is enabled and non-normalized `request`'s are being passed to your handlers. When adopting this flag, you will only need to start leveraging this new parameter if you are relying on the normalization of `request.url` in your application code. If you don't have the flag enabled, then `unstable_url` will match `request.url`. ### [`v7.13.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7131) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.13.0...react-router@7.13.1) ##### Patch Changes - fix null reference exception in bad codepath leading to invalid route tree comparisons ([#&#8203;14780](https://github.com/remix-run/react-router/pull/14780)) - fix: clear timeout when turbo-stream encoding completes ([#&#8203;14810](https://github.com/remix-run/react-router/pull/14810)) - Improve error message when Origin header is invalid ([#&#8203;14743](https://github.com/remix-run/react-router/pull/14743)) - Fix matchPath optional params matching without a "/" separator. ([#&#8203;14689](https://github.com/remix-run/react-router/pull/14689)) - matchPath("/users/:id?", "/usersblah") now returns null. - matchPath("/test_route/:part?", "/test_route_more") now returns null. - add RSC unstable_getRequest ([#&#8203;14758](https://github.com/remix-run/react-router/pull/14758)) - Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#&#8203;14740](https://github.com/remix-run/react-router/pull/14740)) - \[UNSTABLE] Add support for `<Link unstable_mask>` in Data Mode which allows users to navigate to a URL in the router but "mask" the URL displayed in the browser. This is useful for contextual routing usages such as displaying an image in a model on top of a gallery, but displaying a browser URL directly to the image that can be shared and loaded without the contextual gallery in the background. ([#&#8203;14716](https://github.com/remix-run/react-router/pull/14716)) ```tsx // routes/gallery.tsx export function clientLoader({ request }: Route.LoaderArgs) { let sp = new URL(request.url).searchParams; return { images: getImages(), // When the router location has the image param, load the modal data modalImage: sp.has("image") ? getImage(sp.get("image")!) : null, }; } export default function Gallery({ loaderData }: Route.ComponentProps) { return ( <> <GalleryGrid> {loaderData.images.map((image) => ( <Link key={image.id} {/* Navigate the router to /galley?image=N */}} to={`/gallery?image=${image.id}`} {/* But display /images/N in the URL bar */}} unstable_mask={`/images/${image.id}`} > <img src={image.url} alt={image.alt} /> </Link> ))} </GalleryGrid> {/* When the modal data exists, display the modal */} {data.modalImage ? ( <dialog open> <img src={data.modalImage.url} alt={data.modalImage.alt} /> </dialog> ) : null} </> ); } ``` Notes: - The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not. - Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR. - This provides a first-class API to mask URLs in Data Mode to achieve the same behavior you could do in Declarative Mode via [manual `backgroundLocation` management](https://github.com/remix-run/react-router/tree/main/examples/modal). - RSC: Update failed origin checks to return a 400 status and appropriate UI instead of a generic 500 ([#&#8203;14755](https://github.com/remix-run/react-router/pull/14755)) - Preserve query parameters and hash on manifest version mismatch reload ([#&#8203;14813](https://github.com/remix-run/react-router/pull/14813)) ### [`v7.13.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7130) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.12.0...react-router@7.13.0) ##### Minor Changes - Add `crossOrigin` prop to `Links` component ([#&#8203;14687](https://github.com/remix-run/react-router/pull/14687)) ##### Patch Changes - Fix double slash normalization for useNavigate colon urls ([#&#8203;14718](https://github.com/remix-run/react-router/pull/14718)) - Update failed origin checks to return a 400 status instead of a 500 ([#&#8203;14737](https://github.com/remix-run/react-router/pull/14737)) - Bugfix [#&#8203;14666](https://github.com/remix-run/react-router/issues/14666): Inline criticalCss is missing nonce ([#&#8203;14691](https://github.com/remix-run/react-router/pull/14691)) - Loosen `allowedActionOrigins` glob check so `**` matches all domains ([#&#8203;14722](https://github.com/remix-run/react-router/pull/14722)) ### [`v7.12.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7120) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.11.0...react-router@7.12.0) ##### Minor Changes - Add additional layer of CSRF protection by rejecting submissions to UI routes from external origins. If you need to permit access to specific external origins, you can specify them in the `react-router.config.ts` config `allowedActionOrigins` field. ([#&#8203;14708](https://github.com/remix-run/react-router/pull/14708)) ##### Patch Changes - Fix `generatePath` when used with suffixed params (i.e., "/books/:id.json") ([#&#8203;14269](https://github.com/remix-run/react-router/pull/14269)) - Export `UNSAFE_createMemoryHistory` and `UNSAFE_createHashHistory` alongside `UNSAFE_createBrowserHistory` for consistency. These are not intended to be used for new apps but intended to help apps usiong `unstable_HistoryRouter` migrate from v6->v7 so they can adopt the newer APIs. ([#&#8203;14663](https://github.com/remix-run/react-router/pull/14663)) - Escape HTML in scroll restoration keys ([#&#8203;14705](https://github.com/remix-run/react-router/pull/14705)) - Validate redirect locations ([#&#8203;14706](https://github.com/remix-run/react-router/pull/14706)) - \[UNSTABLE] Pass `<Scripts nonce>` value through to the underlying `importmap` `script` tag when using `future.unstable_subResourceIntegrity` ([#&#8203;14675](https://github.com/remix-run/react-router/pull/14675)) - \[UNSTABLE] Add a new `future.unstable_trailingSlashAwareDataRequests` flag to provide consistent behavior of `request.pathname` inside `middleware`, `loader`, and `action` functions on document and data requests when a trailing slash is present in the browser URL. ([#&#8203;14644](https://github.com/remix-run/react-router/pull/14644)) Currently, your HTTP and `request` pathnames would be as follows for `/a/b/c` and `/a/b/c/` | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** | | ------------ | ----------------- | ------------------------ | | **Document** | `/a/b/c` | `/a/b/c` ✅ | | **Data** | `/a/b/c.data` | `/a/b/c` ✅ | | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** | | ------------- | ----------------- | ------------------------ | | **Document** | `/a/b/c/` | `/a/b/c/` ✅ | | **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ | With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests: | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** | | ------------ | ----------------- | ------------------------ | | **Document** | `/a/b/c` | `/a/b/c` ✅ | | **Data** | `/a/b/c.data` | `/a/b/c` ✅ | | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** | | ------------- | ------------------ | ------------------------ | | **Document** | `/a/b/c/` | `/a/b/c/` ✅ | | **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ | This a bug fix but we are putting it behind an opt-in flag because it has the potential to be a "breaking bug fix" if you are relying on the URL format for any other application or caching logic. Enabling this flag also changes the format of client side `.data` requests from `/_root.data` to `/_.data` when navigating to `/` to align with the new format. This does not impact the `request` pathname which is still `/` in all cases. - Preserve `clientLoader.hydrate=true` when using `<HydratedRouter unstable_instrumentations>` ([#&#8203;14674](https://github.com/remix-run/react-router/pull/14674)) ### [`v7.11.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7110) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.10.1...react-router@7.11.0) ##### Minor Changes - Stabilize `<HydratedRouter onError>`/`<RouterProvider onError>` ([#&#8203;14546](https://github.com/remix-run/react-router/pull/14546)) ##### Patch Changes - add support for throwing redirect Response's at RSC render time ([#&#8203;14596](https://github.com/remix-run/react-router/pull/14596)) - Support for throwing `data()` and Response from server component render phase. Response body is not serialized as async work is not allowed as error encoding phase. If you wish to transmit data to the boundary, throw `data()` instead. ([#&#8203;14632](https://github.com/remix-run/react-router/pull/14632)) - Fix `unstable_useTransitions` prop on `<Router>` component to permit omission for backewards compatibility ([#&#8203;14646](https://github.com/remix-run/react-router/pull/14646)) - `routeRSCServerRequest` replace `fetchServer` with `serverResponse` ([#&#8203;14597](https://github.com/remix-run/react-router/pull/14597)) - \[UNSTABLE] Add a new `unstable_defaultShouldRevalidate` flag to various APIs to allow opt-ing out of standard revalidation behaviors. ([#&#8203;14542](https://github.com/remix-run/react-router/pull/14542)) If active routes include a `shouldRevalidate` function, then your value will be passed as `defaultShouldRevalidate` in those function so that the route always has the final revalidation determination. - `<Form method="post" unstable_defaultShouldRevalidate={false}>` - `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })` - `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>` - `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })` This is also available on non-submission APIs that may trigger revalidations due to changing search params: - `<Link to="/" unstable_defaultShouldRevalidate={false}>` - `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })` - `setSearchParams(params, { unstable_defaultShouldRevalidate: false })` - Allow redirects to be returned from client side middleware ([#&#8203;14598](https://github.com/remix-run/react-router/pull/14598)) - Handle `dataStrategy` implementations that return insufficient result sets by adding errors for routes without any available result ([#&#8203;14627](https://github.com/remix-run/react-router/pull/14627)) ### [`v7.10.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7101) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.10.0...react-router@7.10.1) ##### Patch Changes - Update the `useOptimistic` stub we provide for React 18 users to use a stable setter function to avoid potential `useEffect` loops - specifically when using `<Link viewTransition>` ([#&#8203;14628](https://github.com/remix-run/react-router/pull/14628)) ### [`v7.10.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#7100) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.6...react-router@7.10.0) ##### Minor Changes - Stabilize `fetcher.reset()` ([#&#8203;14545](https://github.com/remix-run/react-router/pull/14545)) - ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()` - Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#&#8203;14592](https://github.com/remix-run/react-router/pull/14592)) - The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives - If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience: ```tsx // Before const matchesToLoad = matches.filter((m) => m.shouldLoad); // After const matchesToLoad = matches.filter((m) => m.shouldCallHandler()); ``` - `match.shouldRevalidateArgs` is the argument that will be passed to the route `shouldRevaliate` function - Combined with the parameter accepted by `match.shouldCallHandler`, you can define a custom revalidation behavior for your `dataStrategy`: ```tsx const matchesToLoad = matches.filter((m) => { const defaultShouldRevalidate = customRevalidationBehavior( match.shouldRevalidateArgs, ); return m.shouldCallHandler(defaultShouldRevalidate); // The argument here will override the internal `defaultShouldRevalidate` value }); ``` ##### Patch Changes - Fix a Framework Mode bug where the `defaultShouldRevalidate` parameter to `shouldRevalidate` would not be correct after `action` returned a 4xx/5xx response (`true` when it should have been `false`) ([#&#8203;14592](https://github.com/remix-run/react-router/pull/14592)) - If your `shouldRevalidate` function relied on that parameter, you may have seen unintended revalidations - Fix `fetcher.submit` failing with plain objects containing a `tagName` property ([#&#8203;14534](https://github.com/remix-run/react-router/pull/14534)) - \[UNSTABLE] Add `unstable_pattern` to the parameters for client side `unstable_onError`, refactor how it's called by `RouterProvider` to avoid potential strict mode issues ([#&#8203;14573](https://github.com/remix-run/react-router/pull/14573)) - Add new `unstable_useTransitions` flag to routers to give users control over the usage of [`React.startTransition`](https://react.dev/reference/react/startTransition) and [`React.useOptimistic`](https://react.dev/reference/react/useOptimistic). ([#&#8203;14524](https://github.com/remix-run/react-router/pull/14524)) - Framework Mode + Data Mode: - `<HydratedRouter unstable_transition>`/`<RouterProvider unstable_transition>` - When left unset (current default behavior) - Router state updates are wrapped in `React.startTransition` - ⚠️ This can lead to buggy behaviors if you are wrapping your own navigations/fetchers in `React.startTransition` - You should set the flag to `true` if you run into this scenario to get the enhanced `useOptimistic` behavior (requires React 19) - When set to `true` - Router state updates remain wrapped in `React.startTransition` (as they are without the flag) - `Link`/`Form` navigations will be wrapped in `React.startTransition` - A subset of router state info will be surfaced to the UI *during* navigations via `React.useOptimistic` (i.e., `useNavigation()`, `useFetchers()`, etc.) - ⚠️ This is a React 19 API so you must also be React 19 to opt into this flag for Framework/Data Mode - When set to `false` - The router will not leverage `React.startTransition` or `React.useOptimistic` on any navigations or state changes - Declarative Mode - `<BrowserRouter unstable_useTransitions>` - When left unset - Router state updates are wrapped in `React.startTransition` - When set to `true` - Router state updates remain wrapped in `React.startTransition` (as they are without the flag) - `Link`/`Form` navigations will be wrapped in `React.startTransition` - When set to `false` - the router will not leverage `React.startTransition` on any navigations or state changes - Fix the promise returned from `useNavigate` in Framework/Data Mode so that it properly tracks the duration of `popstate` navigations (i.e., `navigate(-1)`) ([#&#8203;14524](https://github.com/remix-run/react-router/pull/14524)) - Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled ([#&#8203;14577](https://github.com/remix-run/react-router/pull/14577)) - Preserve `statusText` on the `ErrorResponse` instance when throwing `data()` from a route handler ([#&#8203;14555](https://github.com/remix-run/react-router/pull/14555)) - Optimize href() to avoid backtracking regex on splat ([#&#8203;14329](https://github.com/remix-run/react-router/pull/14329)) ### [`v7.9.6`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#796) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.5...react-router@7.9.6) ##### Patch Changes - \[UNSTABLE] Add `location`/`params` as arguments to client-side `unstable_onError` to permit enhanced error reporting. ([#&#8203;14509](https://github.com/remix-run/react-router/pull/14509)) ⚠️ This is a breaking change if you've already adopted `unstable_onError`. The second `errorInfo` parameter is now an object with `location` and `params`: ```tsx // Before function errorHandler(error: unknown, errorInfo?: React.errorInfo) { /*...*/ } // After function errorHandler( error: unknown, info: { location: Location; params: Params; errorInfo?: React.ErrorInfo; }, ) { /*...*/ } ``` - Properly handle ancestor thrown middleware errors before `next()` on fetcher submissions ([#&#8203;14517](https://github.com/remix-run/react-router/pull/14517)) - Fix issue with splat routes interfering with multiple calls to patchRoutesOnNavigation ([#&#8203;14487](https://github.com/remix-run/react-router/pull/14487)) - Normalize double-slashes in `resolvePath` ([#&#8203;14529](https://github.com/remix-run/react-router/pull/14529)) ### [`v7.9.5`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#795) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.4...react-router@7.9.5) ##### Patch Changes - Move RSCHydratedRouter and utils to `/dom` export. ([#&#8203;14457](https://github.com/remix-run/react-router/pull/14457)) - useRoute: return type-safe `handle` ([#&#8203;14462](https://github.com/remix-run/react-router/pull/14462)) For example: ```ts // app/routes/admin.tsx const handle = { hello: "world" }; ``` ```ts // app/routes/some-other-route.tsx export default function Component() { const admin = useRoute("routes/admin"); if (!admin) throw new Error("Not nested within 'routes/admin'"); console.log(admin.handle); // ^? { hello: string } } ``` - Ensure action handlers run for routes with middleware even if no loader is present ([#&#8203;14443](https://github.com/remix-run/react-router/pull/14443)) - Add `unstable_instrumentations` API to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches ([#&#8203;14412](https://github.com/remix-run/react-router/pull/14412)) - Framework Mode: - `entry.server.tsx`: `export const unstable_instrumentations = [...]` - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />` - Data Mode - `createBrowserRouter(routes, { unstable_instrumentations: [...] })` This also adds a new `unstable_pattern` parameter to loaders/actions/middleware which contains the un-interpolated route pattern (i.e., `/blog/:slug`) which is useful for aggregating performance metrics by route ### [`v7.9.4`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#794) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.3...react-router@7.9.4) ##### Patch Changes - handle external redirects in from server actions ([#&#8203;14400](https://github.com/remix-run/react-router/pull/14400)) - New (unstable) `useRoute` hook for accessing data from specific routes ([#&#8203;14407](https://github.com/remix-run/react-router/pull/14407)) For example, let's say you have an `admin` route somewhere in your app and you want any child routes of `admin` to all have access to the `loaderData` and `actionData` from `admin.` ```tsx // app/routes/admin.tsx import { Outlet } from "react-router"; export const loader = () => ({ message: "Hello, loader!" }); export const action = () => ({ count: 1 }); export default function Component() { return ( <div> {/* ... */} <Outlet /> {/* ... */} </div> ); } ``` You might even want to create a reusable widget that all of the routes nested under `admin` could use: ```tsx import { unstable_useRoute as useRoute } from "react-router"; export function AdminWidget() { // How to get `message` and `count` from `admin` route? } ``` In framework mode, `useRoute` knows all your app's routes and gives you TS errors when invalid route IDs are passed in: ```tsx export function AdminWidget() { const admin = useRoute("routes/dmin"); // ^^^^^^^^^^^ } ``` `useRoute` returns `undefined` if the route is not part of the current page: ```tsx export function AdminWidget() { const admin = useRoute("routes/admin"); if (!admin) { throw new Error(`AdminWidget used outside of "routes/admin"`); } } ``` Note: the `root` route is the exception since it is guaranteed to be part of the current page. As a result, `useRoute` never returns `undefined` for `root`. `loaderData` and `actionData` are marked as optional since they could be accessed before the `action` is triggered or after the `loader` threw an error: ```tsx export function AdminWidget() { const admin = useRoute("routes/admin"); if (!admin) { throw new Error(`AdminWidget used outside of "routes/admin"`); } const { loaderData, actionData } = admin; console.log(loaderData); // ^? { message: string } | undefined console.log(actionData); // ^? { count: number } | undefined } ``` If instead of a specific route, you wanted access to the *current* route's `loaderData` and `actionData`, you can call `useRoute` without arguments: ```tsx export function AdminWidget() { const currentRoute = useRoute(); currentRoute.loaderData; currentRoute.actionData; } ``` This usage is equivalent to calling `useLoaderData` and `useActionData`, but consolidates all route data access into one hook: `useRoute`. Note: when calling `useRoute()` (without a route ID), TS has no way to know which route is the current route. As a result, `loaderData` and `actionData` are typed as `unknown`. If you want more type-safety, you can either narrow the type yourself with something like `zod` or you can refactor your app to pass down typed props to your `AdminWidget`: ```tsx export function AdminWidget({ message, count, }: { message: string; count: number; }) { /* ... */ } ``` ### [`v7.9.3`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#793) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.2...react-router@7.9.3) ##### Patch Changes - Do not try to use `turbo-stream` to decode CDN errors that never reached the server ([#&#8203;14385](https://github.com/remix-run/react-router/pull/14385)) - We used to do this but lost this check with the adoption of single fetch - Fix Data Mode regression causing a 404 during initial load in when `middleware` exists without any `loader` functions ([#&#8203;14393](https://github.com/remix-run/react-router/pull/14393)) ### [`v7.9.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#792) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.1...react-router@7.9.2) ##### Patch Changes - - Update client-side router to run client `middleware` on initial load even if no loaders exist ([#&#8203;14348](https://github.com/remix-run/react-router/pull/14348)) - Update `createRoutesStub` to run route middleware - You will need to set the `<RoutesStub future={{ v8_middleware: true }} />` flag to enable the proper `context` type - Update Lazy Route Discovery manifest requests to use a singular comma-separated `paths` query param instead of repeated `p` query params ([#&#8203;14321](https://github.com/remix-run/react-router/pull/14321)) - This is because Cloudflare has a hard limit of 100 URL search param key/value pairs when used as a key for caching purposes - If more that 100 paths were included, the cache key would be incomplete and could produce false-positive cache hits - \[UNSTABLE] Add `fetcher.unstable_reset()` API ([#&#8203;14206](https://github.com/remix-run/react-router/pull/14206)) - Made useOutlet element reference have stable identity in-between route chages ([#&#8203;13382](https://github.com/remix-run/react-router/pull/13382)) - feat: enable full transition support for the rsc router ([#&#8203;14362](https://github.com/remix-run/react-router/pull/14362)) - In RSC Data Mode, handle SSR'd client errors and re-try in the browser ([#&#8203;14342](https://github.com/remix-run/react-router/pull/14342)) - Support `middleware` prop on `<Route>` for usage with a data router via `createRoutesFromElements` ([#&#8203;14357](https://github.com/remix-run/react-router/pull/14357)) - Handle encoded question mark and hash characters in ancestor splat routes ([#&#8203;14249](https://github.com/remix-run/react-router/pull/14249)) - Fail gracefully on manifest version mismatch logic if `sessionStorage` access is blocked ([#&#8203;14335](https://github.com/remix-run/react-router/pull/14335)) ### [`v7.9.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#791) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.9.0...react-router@7.9.1) ##### Patch Changes - Fix internal `Future` interface naming from `middleware` -> `v8_middleware` ([#&#8203;14327](https://github.com/remix-run/react-router/pull/14327)) ### [`v7.9.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#790) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.8.2...react-router@7.9.0) ##### Minor Changes - Stabilize middleware and context APIs. ([#&#8203;14215](https://github.com/remix-run/react-router/pull/14215)) We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use: - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider) - [`createContext`](https://reactrouter.com/api/utils/createContext) - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option - `<HydratedRouter>` [`getContext`](https://reactrouter.com/api/framework-routers/HydratedRouter#getcontext) prop Please see the [Middleware Docs](https://reactrouter.com/how-to/middleware), the [Middleware RFC](https://github.com/remix-run/remix/discussions/7642), and the [Client-side Context RFC](https://github.com/remix-run/react-router/discussions/9856) for more information. ##### Patch Changes - Escape HTML in `meta()` JSON-LD content ([#&#8203;14316](https://github.com/remix-run/react-router/pull/14316)) - Add react-server Await component implementation ([#&#8203;14261](https://github.com/remix-run/react-router/pull/14261)) - In RSC Data Mode when using a custom basename, fix hydration errors for routes that only have client loaders ([#&#8203;14264](https://github.com/remix-run/react-router/pull/14264)) - Make `href` function available in a react-server context ([#&#8203;14262](https://github.com/remix-run/react-router/pull/14262)) - decode each time `getPayload()` is called to allow for "in-context" decoding and hoisting of contextual assets ([#&#8203;14248](https://github.com/remix-run/react-router/pull/14248)) - `href()` now correctly processes routes that have an extension after the parameter or are a single optional parameter. ([#&#8203;13797](https://github.com/remix-run/react-router/pull/13797)) ### [`v7.8.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#782) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.8.1...react-router@7.8.2) ##### Patch Changes - \[UNSTABLE] Remove Data Mode `future.unstable_middleware` flag from `createBrowserRouter` ([#&#8203;14213](https://github.com/remix-run/react-router/pull/14213)) - This is only needed as a Framework Mode flag because of the route modules and the `getLoadContext` type behavior change - In Data Mode, it's an opt-in feature because it's just a new property on a route object, so there's no behavior changes that necessitate a flag - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#&#8203;14162](https://github.com/remix-run/react-router/pull/14162)) - server action revalidation opt out via $SKIP_REVALIDATION field ([#&#8203;14154](https://github.com/remix-run/react-router/pull/14154)) - Properly escape interpolated param values in `generatePath()` ([#&#8203;13530](https://github.com/remix-run/react-router/pull/13530)) - Maintain `ReadonlyMap` and `ReadonlySet` types in server response data. ([#&#8203;13092](https://github.com/remix-run/react-router/pull/13092)) - \[UNSTABLE] Delay serialization of `.data` redirects to 202 responses until after middleware chain ([#&#8203;14205](https://github.com/remix-run/react-router/pull/14205)) - Fix `TypeError` if you throw from `patchRoutesOnNavigation` when no partial matches exist ([#&#8203;14198](https://github.com/remix-run/react-router/pull/14198)) - Fix `basename` usage without a leading slash in data routers ([#&#8203;11671](https://github.com/remix-run/react-router/pull/11671)) - \[UNSTABLE] Update client middleware so it returns the data strategy results allowing for more advanced post-processing middleware ([#&#8203;14151](https://github.com/remix-run/react-router/pull/14151)) ### [`v7.8.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#781) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.8.0...react-router@7.8.1) ##### Patch Changes - Fix usage of optional path segments in nested routes defined using absolute paths ([#&#8203;14135](https://github.com/remix-run/react-router/pull/14135)) - Bubble client pre-next middleware error to the shallowest ancestor that needs to load, not strictly the shallowest ancestor with a loader ([#&#8203;14150](https://github.com/remix-run/react-router/pull/14150)) - Fix optional static segment matching in `matchPath` ([#&#8203;11813](https://github.com/remix-run/react-router/pull/11813)) - Fix prerendering when a `basename` is set with `ssr:false` ([#&#8203;13791](https://github.com/remix-run/react-router/pull/13791)) - Provide `isRouteErrorResponse` utility in `react-server` environments ([#&#8203;14166](https://github.com/remix-run/react-router/pull/14166)) - Propagate non-redirect Responses thrown from middleware to the error boundary on document/data requests ([#&#8203;14182](https://github.com/remix-run/react-router/pull/14182)) - Handle `meta` and `links` Route Exports in RSC Data Mode ([#&#8203;14136](https://github.com/remix-run/react-router/pull/14136)) - Properly convert returned/thrown `data()` values to `Response` instances via `Response.json()` in resource routes and middleware ([#&#8203;14159](https://github.com/remix-run/react-router/pull/14159), [#&#8203;14181](https://github.com/remix-run/react-router/pull/14181)) ### [`v7.8.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#780) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.7.1...react-router@7.8.0) ##### Minor Changes - Add `nonce` prop to `Links` & `PrefetchPageLinks` ([#&#8203;14048](https://github.com/remix-run/react-router/pull/14048)) - Add `loaderData` arguments/properties alongside existing `data` arguments/properties to provide consistency and clarity between `loaderData` and `actionData` across the board ([#&#8203;14047](https://github.com/remix-run/react-router/pull/14047)) - Updated types: `Route.MetaArgs`, `Route.MetaMatch`, `MetaArgs`, `MetaMatch`, `Route.ComponentProps.matches`, `UIMatch` - `@deprecated` warnings have been added to the existing `data` properties to point users to new `loaderData` properties, in preparation for removing the `data` properties in a future major release ##### Patch Changes - Prevent *"Did not find corresponding fetcher result"* console error when navigating during a `fetcher.submit` revalidation ([#&#8203;14114](https://github.com/remix-run/react-router/pull/14114)) - Bubble client-side middleware errors prior to `next` to the appropriate ancestor error boundary ([#&#8203;14138](https://github.com/remix-run/react-router/pull/14138)) - Switch Lazy Route Discovery manifest URL generation to usea standalone `URLSearchParams` instance instead of `URL.searchParams` to avoid a major performance bottleneck in Chrome ([#&#8203;14084](https://github.com/remix-run/react-router/pull/14084)) - Adjust internal RSC usage of `React.use` to avoid Webpack compilation errors when using React 18 ([#&#8203;14113](https://github.com/remix-run/react-router/pull/14113)) - Remove dependency on `@types/node` in TypeScript declaration files ([#&#8203;14059](https://github.com/remix-run/react-router/pull/14059)) - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#&#8203;12206](https://github.com/remix-run/react-router/pull/12206)) - When an `ErrorBoundary` is being rendered, not all active matches will have loader data available, since it may have been their `loader` that threw to trigger the boundary - The `UIMatch.data` type was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when an `ErrorBoundary` was rendered - ⚠️ This may cause some type errors to show up in your code for unguarded `match.data` accesses - you should properly guard for `undefined` values in those scenarios. ```tsx // app/root.tsx export function loader() { someFunctionThatThrows(); // ❌ Throws an Error return { title: "My Title" }; } export function Layout({ children }: { children: React.ReactNode }) { let matches = useMatches(); let rootMatch = matches[0] as UIMatch<Awaited<ReturnType<typeof loader>>>; // ^ rootMatch.data is incorrectly typed here, so TypeScript does not // complain if you do the following which throws an error at runtime: let { title } = rootMatch.data; // 💥 return <html>...</html>; } ``` - \[UNSTABLE] Ensure resource route errors go through `handleError` w/middleware enabled ([#&#8203;14078](https://github.com/remix-run/react-router/pull/14078)) - \[UNSTABLE] Propagate returned Response from server middleware if next wasn't called ([#&#8203;14093](https://github.com/remix-run/react-router/pull/14093)) - \[UNSTABLE] Allow server middlewares to return `data()` values which will be converted into a `Response` ([#&#8203;14093](https://github.com/remix-run/react-router/pull/14093)) - \[UNSTABLE] Update middleware error handling so that the `next` function never throws and instead handles any middleware errors at the proper `ErrorBoundary` and returns the `Response` up through the ancestor `next` function ([#&#8203;14118](https://github.com/remix-run/react-router/pull/14118)) - \[UNSTABLE] When middleware is enabled, make the `context` parameter read-only (via `Readonly<unstable_RouterContextProvider>`) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. ([#&#8203;14097](https://github.com/remix-run/react-router/pull/14097)) - \[UNSTABLE] Rename and alter the signature/functionality of the `unstable_respond` API in `staticHandler.query`/`staticHandler.queryRoute` ([#&#8203;14103](https://github.com/remix-run/react-router/pull/14103)) - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity - The main functional change is that instead of running the loaders/actions before calling `unstable_respond` and handing you the result, we now pass a `query`/`queryRoute` function as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handling - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>` - The `queryRoute` version of the API now has a signature of `(queryRoute: (r: Request) => Promise<Response>) => Promise<Response>` - This allows for more advanced usages such as running logic before/after calling `query` and direct error handling of errors thrown from query - ⚠️ This is a breaking change if you've adopted the `staticHandler` `unstable_respond` API ```tsx let response = await staticHandler.query(request, { requestContext: new unstable_RouterContextProvider(), async unstable_generateMiddlewareResponse(query) { try { // At this point we've run middleware top-down so we need to call the // handlers and generate the Response to bubble back up the middleware let result = await query(request); if (isResponse(result)) { return result; // Redirects, etc. } return await generateHtmlResponse(result); } catch (error: unknown) { return generateErrorResponse(error); } }, }); ``` - \[UNSTABLE] Convert internal middleware implementations to use the new `unstable_generateMiddlewareResponse` API ([#&#8203;14103](https://github.com/remix-run/react-router/pull/14103)) - \[UNSTABLE] Change `getLoadContext` signature (`type GetLoadContextFunction`) when `future.unstable_middleware` is enabled so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to contruct the instance internally ([#&#8203;14097](https://github.com/remix-run/react-router/pull/14097)) - This also removes the `type unstable_InitialContext` export - ⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a `getLoadContext` function - \[UNSTABLE] Run client middleware on client navigations even if no loaders exist ([#&#8203;14106](https://github.com/remix-run/react-router/pull/14106)) - \[UNSTABLE] Change the `unstable_getContext` signature on `RouterProvider`/`HydratedRouter`/`unstable_RSCHydratedRouter` so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to contruct the instance internally ([#&#8203;14097](https://github.com/remix-run/react-router/pull/14097)) - ⚠️ This is a breaking change if you have adopted the `unstable_getContext` prop - \[UNSTABLE] proxy server action side-effect redirects from actions for document and callServer requests ([#&#8203;14131](https://github.com/remix-run/react-router/pull/14131)) - \[UNSTABLE] Fix RSC Data Mode issue where routes that return `false` from `shouldRevalidate` would be replaced by an `<Outlet />` ([#&#8203;14071](https://github.com/remix-run/react-router/pull/14071)) ### [`v7.7.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#771) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.7.0...react-router@7.7.1) ##### Patch Changes - In RSC Data Mode, fix bug where routes with errors weren't forced to revalidate when `shouldRevalidate` returned false ([#&#8203;14026](https://github.com/remix-run/react-router/pull/14026)) - In RSC Data Mode, fix `Matched leaf route at location "/..." does not have an element or Component` warnings when error boundaries are rendered. ([#&#8203;14021](https://github.com/remix-run/react-router/pull/14021)) ### [`v7.7.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#770) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.6.3...react-router@7.7.0) ##### Minor Changes - Add unstable RSC support ([#&#8203;13700](https://github.com/remix-run/react-router/pull/13700)) For more information, see the [RSC documentation](https://reactrouter.com/start/rsc/installation). ##### Patch Changes - Handle `InvalidCharacterError` when validating cookie signature ([#&#8203;13847](https://github.com/remix-run/react-router/pull/13847)) - Pass a copy of `searchParams` to the `setSearchParams` callback function to avoid muations of the internal `searchParams` instance. This was an issue when navigations were blocked because the internal instance be out of sync with `useLocation().search`. ([#&#8203;12784](https://github.com/remix-run/react-router/pull/12784)) - Support invalid `Date` in `turbo-stream` v2 fork ([#&#8203;13684](https://github.com/remix-run/react-router/pull/13684)) - In Framework Mode, clear critical CSS in development after initial render ([#&#8203;13872](https://github.com/remix-run/react-router/pull/13872)) - Strip search parameters from `patchRoutesOnNavigation` `path` param for fetcher calls ([#&#8203;13911](https://github.com/remix-run/react-router/pull/13911)) - Skip scroll restoration on useRevalidator() calls because they're not new locations ([#&#8203;13671](https://github.com/remix-run/react-router/pull/13671)) - Support unencoded UTF-8 routes in prerender config with `ssr` set to `false` ([#&#8203;13699](https://github.com/remix-run/react-router/pull/13699)) - Do not throw if the url hash is not a valid URI component ([#&#8203;13247](https://github.com/remix-run/react-router/pull/13247)) - Fix a regression in `createRoutesStub` introduced with the middleware feature. ([#&#8203;13946](https://github.com/remix-run/react-router/pull/13946)) As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior `AppLoadContext` API. This permitted `createRoutesStub` to work if you were opting into middleware and the updated `context` typings, but broke `createRoutesStub` for users not yet opting into middleware. We've reverted this change and re-implemented it in such a way that both sets of users can leverage it. ```tsx // If you have not opted into middleware, the old API should work again let context: AppLoadContext = { /*...*/ }; let Stub = createRoutesStub(routes, context); // If you have opted into middleware, you should now pass an instantiated `unstable_routerContextProvider` instead of a `getContext` factory function. let context = new unstable_RouterContextProvider(); context.set(SomeContext, someValue); let Stub = createRoutesStub(routes, context); ``` ⚠️ This may be a breaking bug for if you have adopted the unstable Middleware feature and are using `createRoutesStub` with the updated API. - Remove `Content-Length` header from Single Fetch responses ([#&#8203;13902](https://github.com/remix-run/react-router/pull/13902)) ### [`v7.6.3`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#763) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.6.2...react-router@7.6.3) ##### Patch Changes - Do not serialize types for `useRouteLoaderData<typeof clientLoader>` ([#&#8203;13752](https://github.com/remix-run/react-router/pull/13752)) For types to distinguish a `clientLoader` from a `serverLoader`, you MUST annotate `clientLoader` args: ```ts // 👇 annotation required to skip serializing types export function clientLoader({}: Route.ClientLoaderArgs) { return { fn: () => "earth" }; } function SomeComponent() { const data = useRouteLoaderData<typeof clientLoader>("routes/this-route"); const planet = data?.fn() ?? "world"; return <h1>Hello, {planet}!</h1>; } ``` ### [`v7.6.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#762) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.6.1...react-router@7.6.2) ##### Patch Changes - Avoid additional `with-props` chunk in Framework Mode by moving route module component prop logic from the Vite plugin to `react-router` ([#&#8203;13650](https://github.com/remix-run/react-router/pull/13650)) - Slight refactor of internal `headers()` function processing for use with RSC ([#&#8203;13639](https://github.com/remix-run/react-router/pull/13639)) ### [`v7.6.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#761) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.6.0...react-router@7.6.1) ##### Patch Changes - Update `Route.MetaArgs` to reflect that `data` can be potentially `undefined` ([#&#8203;13563](https://github.com/remix-run/react-router/pull/13563)) This is primarily for cases where a route `loader` threw an error to it's own `ErrorBoundary`. but it also arises in the case of a 404 which renders the root `ErrorBoundary`/`meta` but the root loader did not run because not routes matched. - Partially revert optimization added in `7.1.4` to reduce calls to `matchRoutes` because it surfaced other issues ([#&#8203;13562](https://github.com/remix-run/react-router/pull/13562)) - Fix typegen when same route is used at multiple paths ([#&#8203;13574](https://github.com/remix-run/react-router/pull/13574)) For example, `routes/route.tsx` is used at 4 different paths here: ```ts import { type RouteConfig, route } from "@react-router/dev/routes"; export default [ route("base/:base", "routes/base.tsx", [ route("home/:home", "routes/route.tsx", { id: "home" }), route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }), route("splat/*", "routes/route.tsx", { id: "splat" }), ]), route("other/:other", "routes/route.tsx", { id: "other" }), ] satisfies RouteConfig; ``` Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path. Now, typegen creates unions as necessary for alternate paths for the same route file. - Better types for `params` ([#&#8203;13543](https://github.com/remix-run/react-router/pull/13543)) For example: ```ts // routes.ts import { type RouteConfig, route } from "@react-router/dev/routes"; export default [ route("parent/:p", "routes/parent.tsx", [ route("layout/:l", "routes/layout.tsx", [ route("child1/:c1a/:c1b", "routes/child1.tsx"), route("child2/:c2a/:c2b", "routes/child2.tsx"), ]), ]), ] satisfies RouteConfig; ``` Previously, `params` for the `routes/layout.tsx` route were calculated as `{ p: string, l: string }`. This incorrectly ignores params that could come from child routes. If visiting `/parent/1/layout/2/child1/3/4`, the actual params passed to `routes/layout.tsx` will have a type of `{ p: string, l: string, c1a: string, c1b: string }`. Now, `params` are aware of child routes and autocompletion will include child params as optionals: ```ts params.| // ^ cursor is here and you ask for autocompletion // p: string // l: string // c1a?: string // c1b?: string // c2a?: string // c2b?: string ``` You can also narrow the types for `params` as it is implemented as a normalized union of params for each page that includes `routes/layout.tsx`: ```ts if (typeof params.c1a === 'string') { params.| // ^ cursor is here and you ask for autocompletion // p: string // l: string // c1a: string // c1b: string } ``` *** UNSTABLE: renamed internal `react-router/route-module` export to `react-router/internal` UNSTABLE: removed `Info` export from generated `+types/*` files - Avoid initial fetcher execution 404 error when Lazy Route Discovery is interrupted by a navigation ([#&#8203;13564](https://github.com/remix-run/react-router/pull/13564)) - href replaces splats `*` ([#&#8203;13593](https://github.com/remix-run/react-router/pull/13593)) ```ts const a = href("/products/*", { "*": "/1/edit" }); // -> /products/1/edit ``` ### [`v7.6.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#760) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.5.3...react-router@7.6.0) ##### Minor Changes - Added a new `react-router.config.ts` `routeDiscovery` option to configure Lazy Route Discovery behavior. ([#&#8203;13451](https://github.com/remix-run/react-router/pull/13451)) - By default, Lazy Route Discovery is enabled and makes manifest requests to the `/__manifest` path: - `routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }` - You can modify the manifest path used: - `routeDiscovery: { mode: "lazy", manifestPath: "/custom-manifest" }` - Or you can disable this feature entirely and include all routes in the manifest on initial document load: - `routeDiscovery: { mode: "initial" }` - Add support for route component props in `createRoutesStub`. This allows you to unit test your route components using the props instead of the hooks: ([#&#8203;13528](https://github.com/remix-run/react-router/pull/13528)) ```tsx let RoutesStub = createRoutesStub([ { path: "/", Component({ loaderData }) { let data = loaderData as { message: string }; return <pre data-testid="data">Message: {data.message}</pre>; }, loader() { return { message: "hello" }; }, }, ]); render(<RoutesStub />); await waitFor(() => screen.findByText("Message: hello")); ``` ##### Patch Changes - Fix `react-router` module augmentation for `NodeNext` ([#&#8203;13498](https://github.com/remix-run/react-router/pull/13498)) - Don't bundle `react-router` in `react-router/dom` CJS export ([#&#8203;13497](https://github.com/remix-run/react-router/pull/13497)) - Fix bug where a submitting `fetcher` would get stuck in a `loading` state if a revalidating `loader` redirected ([#&#8203;12873](https://github.com/remix-run/react-router/pull/12873)) - Fix hydration error if a server `loader` returned `undefined` ([#&#8203;13496](https://github.com/remix-run/react-router/pull/13496)) - Fix initial load 404 scenarios in data mode ([#&#8203;13500](https://github.com/remix-run/react-router/pull/13500)) - Stabilize `useRevalidator`'s `revalidate` function ([#&#8203;13542](https://github.com/remix-run/react-router/pull/13542)) - Preserve status code if a `clientAction` throws a `data()` result in framework mode ([#&#8203;13522](https://github.com/remix-run/react-router/pull/13522)) - Be defensive against leading double slashes in paths to avoid `Invalid URL` errors from the URL constructor ([#&#8203;13510](https://github.com/remix-run/react-router/pull/13510)) - Note we do not sanitize/normalize these paths - we only detect them so we can avoid the error that would be thrown by `new URL("//", window.location.origin)` - Remove `Navigator` declaration for `navigator.connection.saveData` to avoid messing with any other types beyond `saveData` in userland ([#&#8203;13512](https://github.com/remix-run/react-router/pull/13512)) - Fix `handleError` `params` values on `.data` requests for routes with a dynamic param as the last URL segment ([#&#8203;13481](https://github.com/remix-run/react-router/pull/13481)) - Don't trigger an `ErrorBoundary` UI before the reload when we detect a manifest verison mismatch in Lazy Route Discovery ([#&#8203;13480](https://github.com/remix-run/react-router/pull/13480)) - Inline `turbo-stream@2.4.1` dependency and fix decoding ordering of Map/Set instances ([#&#8203;13518](https://github.com/remix-run/react-router/pull/13518)) - Only render dev warnings in DEV mode ([#&#8203;13461](https://github.com/remix-run/react-router/pull/13461)) - UNSTABLE: Fix a few bugs with error bubbling in middleware use-cases ([#&#8203;13538](https://github.com/remix-run/react-router/pull/13538)) - Short circuit post-processing on aborted `dataStrategy` requests ([#&#8203;13521](https://github.com/remix-run/react-router/pull/13521)) - This resolves non-user-facing console errors of the form `Cannot read properties of undefined (reading 'result')` ### [`v7.5.3`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#753) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.5.2...react-router@7.5.3) ##### Patch Changes - Fix bug where bubbled action errors would result in `loaderData` being cleared at the handling `ErrorBoundary` route ([#&#8203;13476](https://github.com/remix-run/react-router/pull/13476)) - Handle redirects from `clientLoader.hydrate` initial load executions ([#&#8203;13477](https://github.com/remix-run/react-router/pull/13477)) ### [`v7.5.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#752) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.5.1...react-router@7.5.2) ##### Patch Changes - Update Single Fetch to also handle the 204 redirects used in `?_data` requests in Remix v2 ([#&#8203;13364](https://github.com/remix-run/react-router/pull/13364)) - This allows applications to return a redirect on `.data` requests from outside the scope of React Router (i.e., an `express`/`hono` middleware) - ⚠️ Please note that doing so relies on implementation details that are subject to change without a SemVer major release - This is primarily done to ease upgrading to Single Fetch for existing Remix v2 applications, but the recommended way to handle this is redirecting from a route middleware - Adjust approach for Prerendering/SPA Mode via headers ([#&#8203;13453](https://github.com/remix-run/react-router/pull/13453)) ### [`v7.5.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#751) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.5.0...react-router@7.5.1) ##### Patch Changes - Fix single fetch bug where no revalidation request would be made when navigating upwards to a reused parent route ([#&#8203;13253](https://github.com/remix-run/react-router/pull/13253)) - When using the object-based `route.lazy` API, the `HydrateFallback` and `hydrateFallbackElement` properties are now skipped when lazy loading routes after hydration. ([#&#8203;13376](https://github.com/remix-run/react-router/pull/13376)) If you move the code for these properties into a separate file, you can use this optimization to avoid downloading unused hydration code. For example: ```ts createBrowserRouter([ { path: "/show/:showId", lazy: { loader: async () => (await import("./show.loader.js")).loader, Component: async () => (await import("./show.component.js")).Component, HydrateFallback: async () => (await import("./show.hydrate-fallback.js")).HydrateFallback, }, }, ]); ``` - Properly revalidate prerendered paths when param values change ([#&#8203;13380](https://github.com/remix-run/react-router/pull/13380)) - UNSTABLE: Add a new `unstable_runClientMiddleware` argument to `dataStrategy` to enable middleware execution in custom `dataStrategy` implementations ([#&#8203;13395](https://github.com/remix-run/react-router/pull/13395)) - UNSTABLE: Add better error messaging when `getLoadContext` is not updated to return a `Map`" ([#&#8203;13242](https://github.com/remix-run/react-router/pull/13242)) - Do not automatically add `null` to `staticHandler.query()` `context.loaderData` if routes do not have loaders ([#&#8203;13223](https://github.com/remix-run/react-router/pull/13223)) - This was a Remix v2 implementation detail inadvertently left in for React Router v7 - Now that we allow returning `undefined` from loaders, our prior check of `loaderData[routeId] !== undefined` was no longer sufficient and was changed to a `routeId in loaderData` check - these `null` values can cause issues for this new check - ⚠️ This could be a "breaking bug fix" for you if you are doing manual SSR with `createStaticHandler()`/`<StaticRouterProvider>`, and using `context.loaderData` to control `<RouterProvider>` hydration behavior on the client - Fix prerendering when a loader returns a redirect ([#&#8203;13365](https://github.com/remix-run/react-router/pull/13365)) - UNSTABLE: Update context type for `LoaderFunctionArgs`/`ActionFunctionArgs` when middleware is enabled ([#&#8203;13381](https://github.com/remix-run/react-router/pull/13381)) - Add support for the new `unstable_shouldCallHandler`/`unstable_shouldRevalidateArgs` APIs in `dataStrategy` ([#&#8203;13253](https://github.com/remix-run/react-router/pull/13253)) ### [`v7.5.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#750) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.4.1...react-router@7.5.0) ##### Minor Changes - Add granular object-based API for `route.lazy` to support lazy loading of individual route properties, for example: ([#&#8203;13294](https://github.com/remix-run/react-router/pull/13294)) ```ts createBrowserRouter([ { path: "/show/:showId", lazy: { loader: async () => (await import("./show.loader.js")).loader, action: async () => (await import("./show.action.js")).action, Component: async () => (await import("./show.component.js")).Component, }, }, ]); ``` **Breaking change for `route.unstable_lazyMiddleware` consumers** The `route.unstable_lazyMiddleware` property is no longer supported. If you want to lazily load middleware, you must use the new object-based `route.lazy` API with `route.lazy.unstable_middleware`, for example: ```ts createBrowserRouter([ { path: "/show/:showId", lazy: { unstable_middleware: async () => (await import("./show.middleware.js")).middleware, // etc. }, }, ]); ``` ##### Patch Changes - Introduce `unstable_subResourceIntegrity` future flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. ([#&#8203;13163](https://github.com/remix-run/react-router/pull/13163)) ### [`v7.4.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#741) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.4.0...react-router@7.4.1) ##### Patch Changes - Fix types on `unstable_MiddlewareFunction` to avoid type errors when a middleware doesn't return a value ([#&#8203;13311](https://github.com/remix-run/react-router/pull/13311)) - Dedupe calls to `route.lazy` functions ([#&#8203;13260](https://github.com/remix-run/react-router/pull/13260)) - Add support for `route.unstable_lazyMiddleware` function to allow lazy loading of middleware logic. ([#&#8203;13210](https://github.com/remix-run/react-router/pull/13210)) **Breaking change for `unstable_middleware` consumers** The `route.unstable_middleware` property is no longer supported in the return value from `route.lazy`. If you want to lazily load middleware, you must use `route.unstable_lazyMiddleware`. ### [`v7.4.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#740) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.3.0...react-router@7.4.0) ##### Patch Changes - Fix root loader data on initial load redirects in SPA mode ([#&#8203;13222](https://github.com/remix-run/react-router/pull/13222)) - Load ancestor pathless/index routes in lazy route discovery for upwards non-eager-discoery routing ([#&#8203;13203](https://github.com/remix-run/react-router/pull/13203)) - Fix `shouldRevalidate` behavior for `clientLoader`-only routes in `ssr:true` apps ([#&#8203;13221](https://github.com/remix-run/react-router/pull/13221)) - UNSTABLE: Fix `RequestHandler` `loadContext` parameter type when middleware is enabled ([#&#8203;13204](https://github.com/remix-run/react-router/pull/13204)) - UNSTABLE: Update `Route.unstable_MiddlewareFunction` to have a return value of `Response | undefined` instead of `Response | void` becaue you should not return anything if you aren't returning the `Response` ([#&#8203;13199](https://github.com/remix-run/react-router/pull/13199)) - UNSTABLE(BREAKING): If a middleware throws an error, ensure we only bubble the error itself via `next()` and are no longer leaking the `MiddlewareError` implementation detail ([#&#8203;13180](https://github.com/remix-run/react-router/pull/13180)) ### [`v7.3.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#730) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.2.0...react-router@7.3.0) ##### Minor Changes - Add `fetcherKey` as a parameter to `patchRoutesOnNavigation` ([#&#8203;13061](https://github.com/remix-run/react-router/pull/13061)) - In framework mode, Lazy Route Discovery will now detect manifest version mismatches after a new deploy - On navigations to undiscovered routes, this mismatch will trigger a document reload of the destination path - On `fetcher` calls to undiscovered routes, this mismatch will trigger a document reload of the current path ##### Patch Changes - Skip resource route flow in dev server in SPA mode ([#&#8203;13113](https://github.com/remix-run/react-router/pull/13113)) - Support middleware on routes (unstable) ([#&#8203;12941](https://github.com/remix-run/react-router/pull/12941)) Middleware is implemented behind a `future.unstable_middleware` flag. To enable, you must enable the flag and the types in your `react-router-config.ts` file: ```ts import type { Config } from "@react-router/dev/config"; import type { Future } from "react-router"; declare module "react-router" { interface Future { unstable_middleware: true; // 👈 Enable middleware types } } export default { future: { unstable_middleware: true, // 👈 Enable middleware }, } satisfies Config; ``` ⚠️ Middleware is unstable and should not be adopted in production. There is at least one known de-optimization in route module loading for `clientMiddleware` that we will be addressing this before a stable release. ⚠️ Enabling middleware contains a breaking change to the `context` parameter passed to your `loader`/`action` functions - see below for more information. Once enabled, routes can define an array of middleware functions that will run sequentially before route handlers run. These functions accept the same parameters as `loader`/`action` plus an additional `next` parameter to run the remaining data pipeline. This allows middlewares to perform logic before and after handlers execute. ```tsx // Framework mode export const unstable_middleware = [serverLogger, serverAuth]; // server export const unstable_clientMiddleware = [clientLogger]; // client // Library mode const routes = [ { path: "/", // Middlewares are client-side for library mode SPA's unstable_middleware: [clientLogger, clientAuth], loader: rootLoader, Component: Root, }, ]; ``` Here's a simple example of a client-side logging middleware that can be placed on the root route: ```tsx const clientLogger: Route.unstable_ClientMiddlewareFunction = async ( { request }, next, ) => { let start = performance.now(); // Run the remaining middlewares and all route loaders await next(); let duration = performance.now() - start; console.log(`Navigated to ${request.url} (${duration}ms)`); }; ``` Note that in the above example, the `next`/`middleware` functions don't return anything. This is by design as on the client there is no "response" to send over the network like there would be for middlewares running on the server. The data is all handled behind the scenes by the stateful `router`. For a server-side middleware, the `next` function will return the HTTP `Response` that React Router will be sending across the wire, thus giving you a chance to make changes as needed. You may throw a new response to short circuit and respond immediately, or you may return a new or altered response to override the default returned by `next()`. ```tsx const serverLogger: Route.unstable_MiddlewareFunction = async ( { request, params, context }, next, ) => { let start = performance.now(); // 👇 Grab the response here let res = await next(); let duration = performance.now() - start; console.log(`Navigated to ${request.url} (${duration}ms)`); // 👇 And return it here (optional if you don't modify the response) return res; }; ``` You can throw a `redirect` from a middleware to short circuit any remaining processing: ```tsx import { sessionContext } from "../context"; const serverAuth: Route.unstable_MiddlewareFunction = ( { request, params, context }, next, ) => { let session = context.get(sessionContext); let user = session.get("user"); if (!user) { session.set("returnTo", request.url); throw redirect("/login", 302); } }; ``` *Note that in cases like this where you don't need to do any post-processing you don't need to call the `next` function or return a `Response`.* Here's another example of using a server middleware to detect 404s and check the CMS for a redirect: ```tsx const redirects: Route.unstable_MiddlewareFunction = async ({ request, next, }) => { // attempt to handle the request let res = await next(); // if it's a 404, check the CMS for a redirect, do it last // because it's expensive if (res.status === 404) { let cmsRedirect = await checkCMSRedirects(request.url); if (cmsRedirect) { throw redirect(cmsRedirect, 302); } } return res; }; ``` **`context` parameter** When middleware is enabled, your application will use a different type of `context` parameter in your loaders and actions to provide better type safety. Instead of `AppLoadContext`, `context` will now be an instance of `ContextProvider` that you can use with type-safe contexts (similar to `React.createContext`): ```ts import { unstable_createContext } from "react-router"; import { Route } from "./+types/root"; import type { Session } from "./sessions.server"; import { getSession } from "./sessions.server"; let sessionContext = unstable_createContext<Session>(); const sessionMiddleware: Route.unstable_MiddlewareFunction = ({ context, request, }) => { let session = await getSession(request); context.set(sessionContext, session); // ^ must be of type Session }; // ... then in some downstream middleware const loggerMiddleware: Route.unstable_MiddlewareFunction = ({ context, request, }) => { let session = context.get(sessionContext); // ^ typeof Session console.log(session.get("userId"), request.method, request.url); }; // ... or some downstream loader export function loader({ context }: Route.LoaderArgs) { let session = context.get(sessionContext); let profile = await getProfile(session.get("userId")); return { profile }; } ``` If you are using a custom server with a `getLoadContext` function, the return value for initial context values passed from the server adapter layer is no longer an object and should now return an `unstable_InitialContext` (`Map<RouterContext, unknown>`): ```ts let adapterContext = unstable_createContext<MyAdapterContext>(); function getLoadContext(req, res): unstable_InitialContext { let map = new Map(); map.set(adapterContext, getAdapterContext(req)); return map; } ``` - Fix types for loaderData and actionData that contained `Record`s ([#&#8203;13139](https://github.com/remix-run/react-router/pull/13139)) UNSTABLE(BREAKING): `unstable_SerializesTo` added a way to register custom serialization types in Single Fetch for other library and framework authors like Apollo. It was implemented with branded type whose branded property that was made optional so that casting arbitrary values was easy: ```ts // without the brand being marked as optional let x1 = 42 as unknown as unstable_SerializesTo<number>; // ^^^^^^^^^^ // with the brand being marked as optional let x2 = 42 as unstable_SerializesTo<number>; ``` However, this broke type inference in `loaderData` and `actionData` for any `Record` types as those would now (incorrectly) match `unstable_SerializesTo`. This affected all users, not just those that depended on `unstable_SerializesTo`. To fix this, the branded property of `unstable_SerializesTo` is marked as required instead of optional. For library and framework authors using `unstable_SerializesTo`, you may need to add `as unknown` casts before casting to `unstable_SerializesTo`. - Fix single fetch `_root.data` requests when a `basename` is used ([#&#8203;12898](https://github.com/remix-run/react-router/pull/12898)) - Add `context` support to client side data routers (unstable) ([#&#8203;12941](https://github.com/remix-run/react-router/pull/12941)) Your application `loader` and `action` functions on the client will now receive a `context` parameter. This is an instance of `unstable_RouterContextProvider` that you use with type-safe contexts (similar to `React.createContext`) and is most useful with the corresponding `middleware`/`clientMiddleware` API's: ```ts import { unstable_createContext } from "react-router"; type User = { /*...*/ }; let userContext = unstable_createContext<User>(); function sessionMiddleware({ context }) { let user = await getUser(); context.set(userContext, user); } // ... then in some downstream loader function loader({ context }) { let user = context.get(userContext); let profile = await getProfile(user.id); return { profile }; } ``` Similar to server-side requests, a fresh `context` will be created per navigation (or `fetcher` call). If you have initial data you'd like to populate in the context for every request, you can provide an `unstable_getContext` function at the root of your app: - Library mode - `createBrowserRouter(routes, { unstable_getContext })` - Framework mode - `<HydratedRouter unstable_getContext>` This function should return an value of type `unstable_InitialContext` which is a `Map<unstable_RouterContext, unknown>` of context's and initial values: ```ts const loggerContext = unstable_createContext<(...args: unknown[]) => void>(); function logger(...args: unknown[]) { console.log(new Date.toISOString(), ...args); } function unstable_getContext() { let map = new Map(); map.set(loggerContext, logger); return map; } ``` ### [`v7.2.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#720) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.5...react-router@7.2.0) ##### Minor Changes - New type-safe `href` utility that guarantees links point to actual paths in your app ([#&#8203;13012](https://github.com/remix-run/react-router/pull/13012)) ```tsx import { href } from "react-router"; export default function Component() { const link = href("/blog/:slug", { slug: "my-first-post" }); return ( <main> <Link to={href("/products/:id", { id: "asdf" })} /> <NavLink to={href("/:lang?/about", { lang: "en" })} /> </main> ); } ``` ##### Patch Changes - Fix typegen for repeated params ([#&#8203;13012](https://github.com/remix-run/react-router/pull/13012)) In React Router, path parameters are keyed by their name. So for a path pattern like `/a/:id/b/:id?/c/:id`, the last `:id` will set the value for `id` in `useParams` and the `params` prop. For example, `/a/1/b/2/c/3` will result in the value `{ id: 3 }` at runtime. Previously, generated types for params incorrectly modeled repeated params with an array. So `/a/1/b/2/c/3` generated a type like `{ id: [1,2,3] }`. To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters. So `/a/1/b/2/c/3` now generates a type like `{ id: 3 }`. - Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request ([#&#8203;12948](https://github.com/remix-run/react-router/pull/12948)) - Properly handle revalidations to across a prerender/SPA boundary ([#&#8203;13021](https://github.com/remix-run/react-router/pull/13021)) - In "hybrid" applications where some routes are pre-rendered and some are served from a SPA fallback, we need to avoid making `.data` requests if the path wasn't pre-rendered because the request will 404 - We don't know all the pre-rendered paths client-side, however: - All `loader` data in `ssr:false` mode is static because it's generated at build time - A route must use a `clientLoader` to do anything dynamic - Therefore, if a route only has a `loader` and not a `clientLoader`, we disable revalidation by default because there is no new data to retrieve - We short circuit and skip single fetch `.data` request logic if there are no server loaders with `shouldLoad=true` in our single fetch `dataStrategy` - This ensures that the route doesn't cause a `.data` request that would 404 after a submission - Error at build time in `ssr:false` + `prerender` apps for the edge case scenario of: ([#&#8203;13021](https://github.com/remix-run/react-router/pull/13021)) - A parent route has only a `loader` (does not have a `clientLoader`) - The parent route is pre-rendered - The parent route has children routes which are not prerendered - This means that when the child paths are loaded via the SPA fallback, the parent won't have any `loaderData` because there is no server on which to run the `loader` - This can be resolved by either adding a parent `clientLoader` or pre-rendering the child paths - If you add a `clientLoader`, calling the `serverLoader()` on non-prerendered paths will throw a 404 - Add unstable support for splitting route modules in framework mode via `future.unstable_splitRouteModules` ([#&#8203;11871](https://github.com/remix-run/react-router/pull/11871)) - Add `unstable_SerializesTo` brand type for library authors to register types serializable by React Router's streaming format (`turbo-stream`) ([`ab5b05b02`](https://github.com/remix-run/react-router/commit/ab5b05b02f99f062edb3c536c392197c88eb6c77)) - Align dev server behavior with static file server behavior when `ssr:false` is set ([#&#8203;12948](https://github.com/remix-run/react-router/pull/12948)) - When no `prerender` config exists, only SSR down to the root `HydrateFallback` (SPA Mode) - When a `prerender` config exists but the current path is not prerendered, only SSR down to the root `HydrateFallback` (SPA Fallback) - Return a 404 on `.data` requests to non-pre-rendered paths - Improve prefetch performance of CSS side effects in framework mode ([#&#8203;12889](https://github.com/remix-run/react-router/pull/12889)) - Disable Lazy Route Discovery for all `ssr:false` apps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured `__manifest` requests ([#&#8203;12894](https://github.com/remix-run/react-router/pull/12894)) - We previously only disabled this for "SPA Mode" which is `ssr:false` and no `prerender` config but we realized it should apply to all `ssr:false` apps, including those prerendering multiple pages - In those `prerender` scenarios we would prerender the `/__manifest` file assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors - Properly handle interrupted manifest requests in lazy route discovery ([#&#8203;12915](https://github.com/remix-run/react-router/pull/12915)) ### [`v7.1.5`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#715) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.4...react-router@7.1.5) ##### Patch Changes - Fix regression introduced in `7.1.4` via [#&#8203;12800](https://github.com/remix-run/react-router/pull/12800) that caused issues navigating to hash routes inside splat routes for applications using Lazy Route Discovery (`patchRoutesOnNavigation`) ([#&#8203;12927](https://github.com/remix-run/react-router/pull/12927)) ### [`v7.1.4`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#714) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.3...react-router@7.1.4) ##### Patch Changes - Internal reorg to clean up some duplicated route module types ([#&#8203;12799](https://github.com/remix-run/react-router/pull/12799)) - Properly handle status codes that cannot have a body in single fetch responses (204, etc.) ([#&#8203;12760](https://github.com/remix-run/react-router/pull/12760)) - Stop erroring on resource routes that return raw strings/objects and instead serialize them as `text/plain` or `application/json` responses ([#&#8203;12848](https://github.com/remix-run/react-router/pull/12848)) - This only applies when accessed as a resource route without the `.data` extension - When accessed from a Single Fetch `.data` request, they will still be encoded via `turbo-stream` - Optimize Lazy Route Discovery path discovery to favor a single `querySelectorAll` call at the `body` level instead of many calls at the sub-tree level ([#&#8203;12731](https://github.com/remix-run/react-router/pull/12731)) - Properly bubble headers as `errorHeaders` when throwing a `data()` result ([#&#8203;12846](https://github.com/remix-run/react-router/pull/12846)) - Avoid duplication of `Set-Cookie` headers could be duplicated if also returned from `headers` - Optimize route matching by skipping redundant `matchRoutes` calls when possible ([#&#8203;12800](https://github.com/remix-run/react-router/pull/12800)) ### [`v7.1.3`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#713) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.2...react-router@7.1.3) *No changes* ### [`v7.1.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#712) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.1...react-router@7.1.2) ##### Patch Changes - Fix issue with fetcher data cleanup in the data layer on fetcher unmount ([#&#8203;12681](https://github.com/remix-run/react-router/pull/12681)) - Do not rely on `symbol` for filtering out `redirect` responses from loader data ([#&#8203;12694](https://github.com/remix-run/react-router/pull/12694)) Previously, some projects were getting type checking errors like: ```ts error TS4058: Return type of exported function has or is using name 'redirectSymbol' from external module "node_modules/..." but cannot be named. ``` Now that `symbol`s are not used for the `redirect` response type, these errors should no longer be present. ### [`v7.1.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#711) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.1.0...react-router@7.1.1) *No changes* ### [`v7.1.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#710) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.0.2...react-router@7.1.0) ##### Patch Changes - Throw unwrapped single fetch redirect to align with pre-single fetch behavior ([#&#8203;12506](https://github.com/remix-run/react-router/pull/12506)) - Ignore redirects when inferring loader data types ([#&#8203;12527](https://github.com/remix-run/react-router/pull/12527)) - Remove `<Link prefetch>` warning which suffers from false positives in a lazy route discovery world ([#&#8203;12485](https://github.com/remix-run/react-router/pull/12485)) ### [`v7.0.2`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#702) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.0.1...react-router@7.0.2) ##### Patch Changes - temporarily only use one build in export map so packages can have a peer dependency on react router ([#&#8203;12437](https://github.com/remix-run/react-router/pull/12437)) - Generate wide `matches` and `params` types for current route and child routes ([#&#8203;12397](https://github.com/remix-run/react-router/pull/12397)) At runtime, `matches` includes child route matches and `params` include child route path parameters. But previously, we only generated types for parent routes in `matches`; for `params`, we only considered the parent routes and the current route. To align our generated types more closely to the runtime behavior, we now generate more permissive, wider types when accessing child route information. ### [`v7.0.1`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#701) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@7.0.0...react-router@7.0.1) *No changes* ### [`v7.0.0`](https://github.com/remix-run/react-router/blob/HEAD/packages/react-router/CHANGELOG.md#700) [Compare Source](https://github.com/remix-run/react-router/compare/react-router@6.30.6...react-router@7.0.0) ##### Major Changes - Remove the original `defer` implementation in favor of using raw promises via single fetch and `turbo-stream`. This removes these exports from React Router: ([#&#8203;11744](https://github.com/remix-run/react-router/pull/11744)) - `defer` - `AbortedDeferredError` - `type TypedDeferredData` - `UNSAFE_DeferredData` - `UNSAFE_DEFERRED_SYMBOL`, - - Collapse `@remix-run/router` into `react-router` ([#&#8203;11505](https://github.com/remix-run/react-router/pull/11505)) - Collapse `react-router-dom` into `react-router` - Collapse `@remix-run/server-runtime` into `react-router` - Collapse `@remix-run/testing` into `react-router` - Remove single fetch future flag. ([#&#8203;11522](https://github.com/remix-run/react-router/pull/11522)) - Drop support for Node 16, React Router SSR now requires Node 18 or higher ([#&#8203;11391](https://github.com/remix-run/react-router/pull/11391)) - Remove `future.v7_startTransition` flag ([#&#8203;11696](https://github.com/remix-run/react-router/pull/11696)) - - Expose the underlying router promises from the following APIs for compsition in React 19 APIs: ([#&#8203;11521](https://github.com/remix-run/react-router/pull/11521)) - `useNavigate()` - `useSubmit` - `useFetcher().load` - `useFetcher().submit` - `useRevalidator.revalidate` - Remove `future.v7_normalizeFormMethod` future flag ([#&#8203;11697](https://github.com/remix-run/react-router/pull/11697)) - For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#&#8203;11837](https://github.com/remix-run/react-router/pull/11837)) - `createCookie` - `createCookieSessionStorage` - `createMemorySessionStorage` - `createSessionStorage` For consumers running older versions of Node, the `installGlobals` function from `@remix-run/node` has been updated to define `globalThis.crypto`, using [Node's `require('node:crypto').webcrypto` implementation.](https://nodejs.org/api/webcrypto.html) Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed: - `createCookieFactory` - `createSessionStorageFactory` - `createCookieSessionStorageFactory` - `createMemorySessionStorageFactory` - Imports/Exports cleanup ([#&#8203;11840](https://github.com/remix-run/react-router/pull/11840)) - Removed the following exports that were previously public API from `@remix-run/router` - types - `AgnosticDataIndexRouteObject` - `AgnosticDataNonIndexRouteObject` - `AgnosticDataRouteMatch` - `AgnosticDataRouteObject` - `AgnosticIndexRouteObject` - `AgnosticNonIndexRouteObject` - `AgnosticRouteMatch` - `AgnosticRouteObject` - `TrackedPromise` - `unstable_AgnosticPatchRoutesOnMissFunction` - `Action` -> exported as `NavigationType` via `react-router` - `Router` exported as `DataRouter` to differentiate from RR's `<Router>` - API - `getToPathname` (`@private`) - `joinPaths` (`@private`) - `normalizePathname` (`@private`) - `resolveTo` (`@private`) - `stripBasename` (`@private`) - `createBrowserHistory` -> in favor of `createBrowserRouter` - `createHashHistory` -> in favor of `createHashRouter` - `createMemoryHistory` -> in favor of `createMemoryRouter` - `createRouter` - `createStaticHandler` -> in favor of wrapper `createStaticHandler` in RR Dom - `getStaticContextFromError` - Removed the following exports that were previously public API from `react-router` - `Hash` - `Pathname` - `Search` - update minimum node version to 18 ([#&#8203;11690](https://github.com/remix-run/react-router/pull/11690)) - Remove `future.v7_prependBasename` from the ionternalized `@remix-run/router` package ([#&#8203;11726](https://github.com/remix-run/react-router/pull/11726)) - Migrate Remix type generics to React Router ([#&#8203;12180](https://github.com/remix-run/react-router/pull/12180)) - These generics are provided for Remix v2 migration purposes - These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types - Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types - For React Router v6 users, these generics are new and should not impact your app, with one exception - `useFetcher` previously had an optional generic (used primarily by Remix v2) that expected the data type - This has been updated in v7 to expect the type of the function that generates the data (i.e., `typeof loader`/`typeof action`) - Therefore, you should update your usages: - ❌ `useFetcher<LoaderData>()` - ✅ `useFetcher<typeof loader>()` - Remove `future.v7_throwAbortReason` from internalized `@remix-run/router` package ([#&#8203;11728](https://github.com/remix-run/react-router/pull/11728)) - Add `exports` field to all packages ([#&#8203;11675](https://github.com/remix-run/react-router/pull/11675)) - node package no longer re-exports from react-router ([#&#8203;11702](https://github.com/remix-run/react-router/pull/11702)) - renamed RemixContext to FrameworkContext ([#&#8203;11705](https://github.com/remix-run/react-router/pull/11705)) - updates the minimum React version to 18 ([#&#8203;11689](https://github.com/remix-run/react-router/pull/11689)) - PrefetchPageDescriptor replaced by PageLinkDescriptor ([#&#8203;11960](https://github.com/remix-run/react-router/pull/11960)) - - Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#&#8203;12177](https://github.com/remix-run/react-router/pull/12177)) - Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute` - The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest` - `Record<string, Route> -> Record<string, Route | undefined>` - Removed `AppData` type in favor of inlining `unknown` in the few locations it was used - Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from - - Remove the `future.v7_partialHydration` flag ([#&#8203;11725](https://github.com/remix-run/react-router/pull/11725)) - This also removes the `<RouterProvider fallbackElement>` prop - To migrate, move the `fallbackElement` to a `hydrateFallbackElement`/`HydrateFallback` on your root route - Also worth nothing there is a related breaking changer with this future flag: - Without `future.v7_partialHydration` (when using `fallbackElement`), `state.navigation` was populated during the initial load - With `future.v7_partialHydration`, `state.navigation` remains in an `"idle"` state during the initial load - Remove `v7_relativeSplatPath` future flag ([#&#8203;11695](https://github.com/remix-run/react-router/pull/11695)) - Drop support for Node 18, update minimum Node vestion to 20 ([#&#8203;12171](https://github.com/remix-run/react-router/pull/12171)) - Remove `installGlobals()` as this should no longer be necessary - Remove remaining future flags ([#&#8203;11820](https://github.com/remix-run/react-router/pull/11820)) - React Router `v7_skipActionErrorRevalidation` - Remix `v3_fetcherPersist`, `v3_relativeSplatPath`, `v3_throwAbortReason` - rename createRemixStub to createRoutesStub ([#&#8203;11692](https://github.com/remix-run/react-router/pull/11692)) - Remove `@remix-run/router` deprecated `detectErrorBoundary` option in favor of `mapRouteProperties` ([#&#8203;11751](https://github.com/remix-run/react-router/pull/11751)) - Add `react-router/dom` subpath export to properly enable `react-dom` as an optional `peerDependency` ([#&#8203;11851](https://github.com/remix-run/react-router/pull/11851)) - This ensures that we don't blindly `import ReactDOM from "react-dom"` in `<RouterProvider>` in order to access `ReactDOM.flushSync()`, since that would break `createMemoryRouter` use cases in non-DOM environments - DOM environments should import from `react-router/dom` to get the proper component that makes `ReactDOM.flushSync()` available: - If you are using the Vite plugin, use this in your `entry.client.tsx`: - `import { HydratedRouter } from 'react-router/dom'` - If you are not using the Vite plugin and are manually calling `createBrowserRouter`/`createHashRouter`: - `import { RouterProvider } from "react-router/dom"` - Remove `future.v7_fetcherPersist` flag ([#&#8203;11731](https://github.com/remix-run/react-router/pull/11731)) - Update `cookie` dependency to `^1.0.1` - please see the [release notes](https://github.com/jshttp/cookie/releases) for any breaking changes ([#&#8203;12172](https://github.com/remix-run/react-router/pull/12172)) ##### Minor Changes - - Add support for `prerender` config in the React Router vite plugin, to support existing SSG use-cases ([#&#8203;11539](https://github.com/remix-run/react-router/pull/11539)) - You can use the `prerender` config to pre-render your `.html` and `.data` files at build time and then serve them statically at runtime (either from a running server or a CDN) - `prerender` can either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc. ```ts // react-router.config.ts import type { Config } from "@react-router/dev/config"; export default { async prerender() { let slugs = await fakeGetSlugsFromCms(); // Prerender these paths into `.html` files at build time, and `.data` // files if they have loaders return ["/", "/about", ...slugs.map((slug) => `/product/${slug}`)]; }, } satisfies Config; async function fakeGetSlugsFromCms() { await new Promise((r) => setTimeout(r, 1000)); return ["shirt", "hat"]; } ``` - Params, loader data, and action data as props for route component exports ([#&#8203;11961](https://github.com/remix-run/react-router/pull/11961)) ```tsx export default function Component({ params, loaderData, actionData }) {} export function HydrateFallback({ params }) {} export function ErrorBoundary({ params, loaderData, actionData }) {} ``` - Remove duplicate `RouterProvider` impliementations ([#&#8203;11679](https://github.com/remix-run/react-router/pull/11679)) - ### Typesafety improvements ([#&#8203;12019](https://github.com/remix-run/react-router/pull/12019)) React Router now generates types for each of your route modules. You can access those types by importing them from `./+types.<route filename without extension>`. For example: ```ts // app/routes/product.tsx import type * as Route from "./+types.product"; export function loader({ params }: Route.LoaderArgs) {} export default function Component({ loaderData }: Route.ComponentProps) {} ``` This initial implementation targets type inference for: - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module - `ActionData` : Action data from `action` and/or `clientAction` within your route module In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc. We also plan to generate types for typesafe `Link`s: ```tsx <Link to="/products/:id" params={{ id: 1 }} /> // ^^^^^^^^^^^^^ ^^^^^^^^^ // typesafe `to` and `params` based on the available routes in your app ``` Check out our docs for more: - [*Explanations > Type Safety*](https://reactrouter.com/dev/guides/explanation/type-safety) - [*How-To > Setting up type safety*](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety) - Stabilize `unstable_dataStrategy` ([#&#8203;11969](https://github.com/remix-run/react-router/pull/11969)) - Stabilize `unstable_patchRoutesOnNavigation` ([#&#8203;11970](https://github.com/remix-run/react-router/pull/11970)) ##### Patch Changes - No changes ([`506329c4e`](https://github.com/remix-run/react-router/commit/506329c4e2e7aba9837cbfa44df6103b49423745)) - chore: re-enable development warnings through a `development` exports condition. ([#&#8203;12269](https://github.com/remix-run/react-router/pull/12269)) - Remove unstable upload handler. ([#&#8203;12015](https://github.com/remix-run/react-router/pull/12015)) - Remove unneeded dependency on [@&#8203;web3-storage/multipart-parser](https://github.com/web3-storage/multipart-parser) ([#&#8203;12274](https://github.com/remix-run/react-router/pull/12274)) - Fix redirects returned from loaders/actions using `data()` ([#&#8203;12021](https://github.com/remix-run/react-router/pull/12021)) - fix(react-router): (v7) fix static prerender of non-ascii characters ([#&#8203;12161](https://github.com/remix-run/react-router/pull/12161)) - Replace `substr` with `substring` ([#&#8203;12080](https://github.com/remix-run/react-router/pull/12080)) - Remove the deprecated `json` utility ([#&#8203;12146](https://github.com/remix-run/react-router/pull/12146)) - You can use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) if you still need to construct JSON responses in your app - Remove unneeded dependency on source-map ([#&#8203;12275](https://github.com/remix-run/react-router/pull/12275)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC43OS4yIiwidXBkYXRlZEluVmVyIjoiNDQuMTgxLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyIsInZ1bG5lcmFiaWxpdHkiXX0=-->
fix(deps): update dependency react-router to v7 [security]
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
b38c60bc51
Member

Review Summary

This Renovate PR bumps react-router from ^6.30.6 to ^7.0.0 in packages/app/package.json while leaving react-router-dom at ^6.30.6. The lockfile confirms the resulting skew: both react-router@6.30.6 (required by react-router-dom@6) and react-router@7.18.5 are installed side by side.

This version mismatch is unsupported in React Router v7, where react-router-dom was collapsed into react-router. Mixing v6 and v7 can cause duplicate router contexts and inconsistent Link/useNavigate behavior across Backstage plugins that still resolve v6.

Backstage 1.55 core packages (@backstage/core-components, @backstage/frontend-app-api, etc.) currently peer-depend on react-router ^6. Forcing v7 risks peer-dependency violations and runtime routing failures in Backstage's internal shell, even though this app's own code does not import react-router directly.

The cited CVEs are medium severity with limited applicability to this declarative-mode SPA: CVE-2026-53666 only affects Framework/Data Mode manual SSR/hydration, and CVE-2026-53669 requires attacker-controlled navigation paths not present in this codebase.

Recommendation: close or park until Backstage officially supports react-router v7. If partial mitigation is needed, audit navigation call sites for the open-redirect issue; do not merge the v7 bump as-is.


*🤖 Review by opencode (opencode/mimo-v2.6-flash-free) — verdict: changes

# Review Summary This Renovate PR bumps `react-router` from `^6.30.6` to `^7.0.0` in `packages/app/package.json` while leaving `react-router-dom` at `^6.30.6`. The lockfile confirms the resulting skew: both `react-router@6.30.6` (required by `react-router-dom@6`) and `react-router@7.18.5` are installed side by side. This version mismatch is unsupported in React Router v7, where `react-router-dom` was collapsed into `react-router`. Mixing v6 and v7 can cause duplicate router contexts and inconsistent `Link`/`useNavigate` behavior across Backstage plugins that still resolve v6. Backstage 1.55 core packages (`@backstage/core-components`, `@backstage/frontend-app-api`, etc.) currently peer-depend on react-router ^6. Forcing v7 risks peer-dependency violations and runtime routing failures in Backstage's internal shell, even though this app's own code does not import react-router directly. The cited CVEs are medium severity with limited applicability to this declarative-mode SPA: CVE-2026-53666 only affects Framework/Data Mode manual SSR/hydration, and CVE-2026-53669 requires attacker-controlled navigation paths not present in this codebase. **Recommendation:** close or park until Backstage officially supports react-router v7. If partial mitigation is needed, audit navigation call sites for the open-redirect issue; do not merge the v7 bump as-is. --- *🤖 Review by opencode (opencode/mimo-v2.6-flash-free) — verdict: **changes** <!-- forgejo-opencode-review -->
clank-bot left a comment

Code review findings from opencode.

Code review findings from opencode. <!-- forgejo-opencode-review -->
@ -45,3 +45,3 @@
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router": "^6.30.2",
"react-router": "^7.0.0",
Member
[bug] Bumping `react-router` to `^7.0.0` while `react-router-dom` stays on `^6.30.2` installs both react-router 6.30.6 and 7.18.5 into the lockfile. In React Router v7 the DOM bindings were merged into `react-router`; this version skew is unsupported and can cause duplicate router contexts or broken navigation between Backstage plugins (which still resolve v6) and the app (which now resolves v7). Either upgrade `react-router-dom`/the whole stack together once Backstage supports v7, or keep both packages on v6 until then.
<!-- forgejo-opencode-review --> [bug] Bumping `react-router` to `^7.0.0` while `react-router-dom` stays on `^6.30.2` installs both react-router 6.30.6 and 7.18.5 into the lockfile. In React Router v7 the DOM bindings were merged into `react-router`; this version skew is unsupported and can cause duplicate router contexts or broken navigation between Backstage plugins (which still resolve v6) and the app (which now resolves v7). Either upgrade `react-router-dom`/the whole stack together once Backstage supports v7, or keep both packages on v6 until then.
Member
[security] Backstage 1.55 core packages (`@backstage/core-components`, `@backstage/frontend-app-api`, etc.) currently peer-depend on react-router ^6. Forcing v7 here risks peer-dependency violations and runtime routing failures in Backstage's internal shell, even though this app's own code does not import react-router directly. Additionally, the cited CVEs are medium severity and largely non-applicable to this declarative-mode SPA (CVE-2026-53666 is SSR/hydration-only; CVE-2026-53669 needs attacker-controlled navigation paths). Prefer waiting for an ecosystem-supported upgrade path over a Renovate-driven major bump.
<!-- forgejo-opencode-review --> [security] Backstage 1.55 core packages (`@backstage/core-components`, `@backstage/frontend-app-api`, etc.) currently peer-depend on react-router ^6. Forcing v7 here risks peer-dependency violations and runtime routing failures in Backstage's internal shell, even though this app's own code does not import react-router directly. Additionally, the cited CVEs are medium severity and largely non-applicable to this declarative-mode SPA (CVE-2026-53666 is SSR/hydration-only; CVE-2026-53669 needs attacker-controlled navigation paths). Prefer waiting for an ecosystem-supported upgrade path over a Renovate-driven major bump.
renovate-bot force-pushed renovate/npm-react-router-vulnerability from b38c60bc51
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
to b166dea719 2026-11-15 20:39:39 +00:00
Compare
renovate-bot force-pushed renovate/npm-react-router-vulnerability from b166dea719 to a3ab7b8806
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
2026-11-17 20:39:13 +00:00
Compare
renovate-bot force-pushed renovate/npm-react-router-vulnerability from a3ab7b8806
All checks were successful
ci/woodpecker/pr/pr-review Pipeline was successful
to 7cca99f3f4
Some checks failed
renovate/artifacts Artifact file update failure
ci/woodpecker/push/renovate-lint Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
ci/woodpecker/pr/pr-review Pipeline failed
2026-11-21 23:08:07 +00:00
Compare
renovate-bot changed title from fix(deps): update dependency react-router to v7 [security] to fix(deps): update dependency react-router to v8 [security] 2026-11-21 23:08:15 +00:00
Author
Member

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: bun.lock
2 |   "lockfileVersion": 2,
                         ^
error: Unknown lockfile version
    at bun.lock:2:22
UnknownLockfileVersion: failed to parse lockfile: 'bun.lock'

warn: Ignoring lockfile
Resolving dependencies
Resolved, downloaded and extracted [9522]
warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "eslint-plugin-react-hooks@5.2.0"

warn: incorrect peer dependency "react@18.3.1"

warn: incorrect peer dependency "react-dom@18.3.1"

warn: incorrect peer dependency "@codemirror/language@6.13.1"

error: Package "app" is not linked

To install a linked package:
   bun link my-pkg-name-from-package-json

Tip: the package name is from package.json, which can differ from the folder name.

error: app@link:../app failed to resolve

### ⚠️ Artifact update problem Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is. ♻ Renovate will retry this branch, including artifacts, only when one of the following happens: - any of the package files in this branch needs updating, or - the branch becomes conflicted, or - you click the rebase/retry checkbox if found above, or - you rename this PR's title to start with "rebase!" to trigger it manually The artifact failure details are included below: ##### File name: bun.lock ``` 2 | "lockfileVersion": 2, ^ error: Unknown lockfile version at bun.lock:2:22 UnknownLockfileVersion: failed to parse lockfile: 'bun.lock' warn: Ignoring lockfile Resolving dependencies Resolved, downloaded and extracted [9522] warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "eslint-plugin-react-hooks@5.2.0" warn: incorrect peer dependency "react@18.3.1" warn: incorrect peer dependency "react-dom@18.3.1" warn: incorrect peer dependency "@codemirror/language@6.13.1" error: Package "app" is not linked To install a linked package: bun link my-pkg-name-from-package-json Tip: the package name is from package.json, which can differ from the folder name. error: app@link:../app failed to resolve ```
Some checks failed
renovate/artifacts Artifact file update failure
ci/woodpecker/push/renovate-lint Pipeline was successful
ci/woodpecker/pr/application-checks Pipeline failed
ci/woodpecker/pr/pr-review Pipeline failed
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'renovate/npm-react-router-vulnerability:renovate/npm-react-router-vulnerability'
git switch 'renovate/npm-react-router-vulnerability'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'renovate/npm-react-router-vulnerability'
git switch 'renovate/npm-react-router-vulnerability'
git rebase 'main'
git switch 'main'
git merge --ff-only 'renovate/npm-react-router-vulnerability'
git switch 'renovate/npm-react-router-vulnerability'
git rebase 'main'
git switch 'main'
git merge --no-ff 'renovate/npm-react-router-vulnerability'
git switch 'main'
git merge --squash 'renovate/npm-react-router-vulnerability'
git switch 'main'
git merge --ff-only 'renovate/npm-react-router-vulnerability'
git switch 'main'
git merge 'renovate/npm-react-router-vulnerability'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Personal/backstage!7
No description provided.