Packages

react-router

8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed

Your version

7.8.0

7 Aug 2025Where it was published

7.18.6 is the newest release of 7.x.

In short

2 new18 fixed

Security

14 advisories affect 7.8.0; 7.18.0 fixes them

9 more

Release note

The section about react-router of a note shared by several packages.

Minor Changes

  • Add nonce prop to Links & PrefetchPageLinks

  • Add loaderData arguments/properties alongside existing data arguments/properties to provide consistency and clarity between loaderData and actionData across the board

    • 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

  • Bubble client-side middleware errors prior to next to the appropriate ancestor error boundary

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

  • Adjust internal RSC usage of React.use to avoid Webpack compilation errors when using React 18

  • Remove dependency on @types/node in TypeScript declaration files

  • Fix types for UIMatch to reflect that the loaderData/data properties may be undefined

    • 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

  • [UNSTABLE] Propagate returned Response from server middleware if next wasn't called

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

  • [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

  • [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.

  • [UNSTABLE] Rename and alter the signature/functionality of the unstable_respond API in staticHandler.query/staticHandler.queryRoute

    • 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

  • [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

    • 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

  • [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

    • ⚠️ 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

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

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.