Skip to content

v2.22.0

Choose a tag to compare

@github-actions github-actions released this 27 Oct 22:32
· 26 commits to main since this release
def85d5

Minor Changes

Important

To make the typing works correctly, in your react-router.config.ts or where you want, add future v8_middleware flag type to true.

declare module "react-router" {
 interface Future {
   v8_middleware: true; // 👈 Enable middleware types
 }
}

Or in your react-router.config.ts:

future: {
     v8_middleware: true,
 },

Dependency upgrades

  • Bumped Hono stack:
    • hono -> 4.10.3
    • @hono/node-server -> 1.19.5
    • @hono/vite-dev-server -> 0.23.0
  • React / Router:
    • react -> 19.2.0
    • react-dom -> 19.2.0
    • react-router -> 7.9.4
    • @react-router/dev -> 7.9.4 (examples updated)

API / Typing changes (important for consumers)

  • React Router middleware typing changed from the unstable names to stable-like names:
    • unstable_RouterContextProvider -> RouterContextProvider
    • unstable_createContext -> createContext
    • Update imports and usage where middleware context/provider was previously unstable_*.
  • To enable middleware types in consumers, declare the future flag:
    • Add v8_middleware: true to your react-router.config.ts (or declare module augmentation) — README and example updated with guidance.
  • If you override getLoadContext for middleware, return the new RouterContextProvider (formerly unstable_RouterContextProvider).

Breaking / required changes for consumers

  • Node engine requirement increased:
    • package.json engines: node >= 22.20.0
  • If you rely on unstable_RouterContextProvider / unstable_createContext, update to RouterContextProvider / createContext and ensure you enable v8_middleware typing as described.
  • Example projects and README were updated; follow those examples when upgrading.

Documentation

  • README updated with:
    • Middleware typing guidance and examples.
    • Migration notes for getLoadContext changes.
  • Examples updated in examples/node/simple-future-middleware to reflect new imports, config, and dependency versions.