react-router
Advanced tools
Changelog
v7.6.2
Date: 2025-06-03
create-react-router
- Update tar-fs
(#13675)
react-router
- (INTERNAL) Slight refactor of internal headers()
function processing for use with RSC (#13639)
react-router
@react-router/dev
- Avoid additional with-props
chunk in Framework Mode by moving route module component prop logic from the Vite plugin to react-router
(#13650)
@react-router/dev
- When future.unstable_viteEnvironmentApi
is enabled and an absolute Vite base
has been configured, ensure critical CSS is handled correctly during development (#13598)
@react-router/dev
- Update vite-node
(#13673)
@react-router/dev
- Fix typegen for non-{.js,.jsx,.ts,.tsx} routes like .mdx (#12453)
@react-router/dev
- Fix href types for optional dynamic params (#13725)
7.6.1 introduced fixes for href
when using optional static segments,
but those fixes caused regressions with how optional dynamic params worked in 7.6.0:
// 7.6.0
href("/users/:id?"); // ✅
href("/users/:id?", { id: 1 }); // ✅
// 7.6.1
href("/users/:id?"); // ❌
href("/users/:id?", { id: 1 }); // ❌
Now, optional static segments are expanded into different paths for href
, but optional dynamic params are not.
This way href
can unambiguously refer to an exact URL path, all while keeping the number of path options to a minimum.
// 7.6.2
// path: /users/:id?/edit?
href("
// ^ suggestions when cursor is here:
//
// /users/:id?
// /users/:id?/edit
Additionally, you can pass params
from component props without needing to narrow them manually:
declare const params: { id?: number };
// 7.6.0
href("/users/:id?", params);
// 7.6.1
href("/users/:id?", params); // ❌
"id" in params ? href("/users/:id", params) : href("/users"); // works... but is annoying
// 7.6.2
href("/users/:id?", params); // restores behavior of 7.6.0
create-react-router
react-router
@react-router/architect
@react-router/cloudflare
@react-router/dev
@react-router/express
@react-router/fs-routes
@react-router/node
@react-router/remix-config-routes-adapter
@react-router/serve
Full Changelog: v7.6.1...v7.6.2