fix(deps): update react-router monorepo to ^7.6.2
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| react-router (source) | ^7.3.0 -> ^7.6.2 |
||||
| react-router-dom (source) | ^7.3.0 -> ^7.6.2 |
Release Notes
remix-run/react-router (react-router)
v7.6.2
Patch Changes
- Avoid additional
with-propschunk in Framework Mode by moving route module component prop logic from the Vite plugin toreact-router(#13650) - [INTERNAL] Slight refactor of internal
headers()function processing for use with RSC (#13639)
v7.6.1
Patch Changes
-
Update
Route.MetaArgsto reflect thatdatacan be potentiallyundefined(#13563)This is primarily for cases where a route
loaderthrew an error to it's ownErrorBoundary. but it also arises in the case of a 404 which renders the rootErrorBoundary/metabut the root loader did not run because not routes matched. -
Partially revert optimization added in
7.1.4to reduce calls tomatchRoutesbecause it surfaced other issues (#13562) -
Fix typegen when same route is used at multiple paths (#13574)
For example,
routes/route.tsxis 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,
paramsfor theroutes/layout.tsxroute 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 toroutes/layout.tsxwill have a type of{ p: string, l: string, c1a: string, c1b: string }.Now,
paramsare 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?: stringYou can also narrow the types for
paramsas it is implemented as a normalized union of params for each page that includesroutes/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-moduleexport toreact-router/internalUNSTABLE: removedInfoexport 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
Minor Changes
-
Added a new
react-router.config.tsrouteDiscoveryoption to configure Lazy Route Discovery behavior. (#13451)- By default, Lazy Route Discovery is enabled and makes manifest requests to the
/__manifestpath:-
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" }
-
- By default, Lazy Route Discovery is enabled and makes manifest requests to the
-
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-routermodule augmentation forNodeNext(#13498) -
Don't bundle
react-routerinreact-router/domCJS export (#13497) -
Fix bug where a submitting
fetcherwould get stuck in aloadingstate if a revalidatingloaderredirected (#12873) -
Fix hydration error if a server
loaderreturnedundefined(#13496) -
Fix initial load 404 scenarios in data mode (#13500)
-
Stabilize
useRevalidator'srevalidatefunction (#13542) -
Preserve status code if a
clientActionthrows adata()result in framework mode (#13522) -
Be defensive against leading double slashes in paths to avoid
Invalid URLerrors 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)
- Note we do not sanitize/normalize these paths - we only detect them so we can avoid the error that would be thrown by
-
Remove
Navigatordeclaration fornavigator.connection.saveDatato avoid messing with any other types beyondsaveDatain userland (#13512) -
Fix
handleErrorparamsvalues on.datarequests for routes with a dynamic param as the last URL segment (#13481) -
Don't trigger an
ErrorBoundaryUI before the reload when we detect a manifest verison mismatch in Lazy Route Discovery (#13480) -
Inline
[email protected]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
dataStrategyrequests (#13521)- This resolves non-user-facing console errors of the form
Cannot read properties of undefined (reading 'result')
- This resolves non-user-facing console errors of the form
v7.5.3
Patch Changes
- Fix bug where bubbled action errors would result in
loaderDatabeing cleared at the handlingErrorBoundaryroute (#13476) - Handle redirects from
clientLoader.hydrateinitial load executions (#13477)
v7.5.2
Patch Changes
-
Update Single Fetch to also handle the 204 redirects used in
?_datarequests in Remix v2 (#13364)- This allows applications to return a redirect on
.datarequests from outside the scope of React Router (i.e., anexpress/honomiddleware) - ⚠️ 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
- This allows applications to return a redirect on
-
Adjust approach for Prerendering/SPA Mode via headers (#13453)
v7.5.1
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.lazyAPI, theHydrateFallbackandhydrateFallbackElementproperties 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_runClientMiddlewareargument todataStrategyto enable middleware execution in customdataStrategyimplementations (#13395) -
UNSTABLE: Add better error messaging when
getLoadContextis not updated to return aMap" (#13242) -
Do not automatically add
nulltostaticHandler.query()context.loaderDataif 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
undefinedfrom loaders, our prior check ofloaderData[routeId] !== undefinedwas no longer sufficient and was changed to arouteId in loaderDatacheck - thesenullvalues 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 usingcontext.loaderDatato control<RouterProvider>hydration behavior on the client
-
Fix prerendering when a loader returns a redirect (#13365)
-
UNSTABLE: Update context type for
LoaderFunctionArgs/ActionFunctionArgswhen middleware is enabled (#13381) -
Add support for the new
unstable_shouldCallHandler/unstable_shouldRevalidateArgsAPIs indataStrategy(#13253)
v7.5.0
Minor Changes
-
Add granular object-based API for
route.lazyto 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_lazyMiddlewareconsumersThe
route.unstable_lazyMiddlewareproperty is no longer supported. If you want to lazily load middleware, you must use the new object-basedroute.lazyAPI withroute.lazy.unstable_middleware, for example:createBrowserRouter([ { path: "/show/:showId", lazy: { unstable_middleware: async () => (await import("./show.middleware.js")).middleware, // etc. }, }, ]);
Patch Changes
- Introduce
unstable_subResourceIntegrityfuture flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. (#13163)
v7.4.1
Patch Changes
-
Fix types on
unstable_MiddlewareFunctionto avoid type errors when a middleware doesn't return a value (#13311) -
Dedupe calls to
route.lazyfunctions (#13260) -
Add support for
route.unstable_lazyMiddlewarefunction to allow lazy loading of middleware logic. (#13210)Breaking change for
unstable_middlewareconsumersThe
route.unstable_middlewareproperty is no longer supported in the return value fromroute.lazy. If you want to lazily load middleware, you must useroute.unstable_lazyMiddleware.
v7.4.0
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
shouldRevalidatebehavior forclientLoader-only routes inssr:trueapps (#13221) - UNSTABLE: Fix
RequestHandlerloadContextparameter type when middleware is enabled (#13204) - UNSTABLE: Update
Route.unstable_MiddlewareFunctionto have a return value ofResponse | undefinedinstead ofResponse | voidbecaue you should not return anything if you aren't returning theResponse(#13199) - UNSTABLE(BREAKING): If a middleware throws an error, ensure we only bubble the error itself via
next()and are no longer leaking theMiddlewareErrorimplementation detail (#13180)
remix-run/react-router (react-router-dom)
v7.6.2
Patch Changes
- Updated dependencies:
v7.6.1
Patch Changes
- Updated dependencies:
v7.6.0
Patch Changes
- Updated dependencies:
v7.5.3
Patch Changes
- Updated dependencies:
v7.5.2
Patch Changes
- Updated dependencies:
v7.5.1
Patch Changes
- Updated dependencies:
v7.5.0
Patch Changes
- Updated dependencies:
v7.4.1
Patch Changes
- Updated dependencies:
v7.4.0
Patch Changes
- Updated dependencies:
Configuration
📅 Schedule: 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 these updates again.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
Preview: https://patternfly-react-pr-11692.surge.sh
A11y report: https://patternfly-react-pr-11692-a11y.surge.sh
Preview: https://pf-react-pr-11692.surge.sh
A11y report: https://pf-react-pr-11692-a11y.surge.sh