File tree Expand file tree Collapse file tree
packages/react-router/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " react-router " : patch
3+ ---
4+
5+ Partially revert optimization added in ` 6.29.0 ` to reduce calls to ` matchRoutes ` because it surfaced other issues
Original file line number Diff line number Diff line change 11import * as React from "react" ;
22import type {
3- AgnosticRouteMatch ,
43 Blocker ,
54 BlockerFunction ,
65 Location ,
@@ -359,7 +358,7 @@ export function useRoutesImpl(
359358 `useRoutes() may be used only in the context of a <Router> component.`
360359 ) ;
361360
362- let { navigator, static : isStatic } = React . useContext ( NavigationContext ) ;
361+ let { navigator } = React . useContext ( NavigationContext ) ;
363362 let { matches : parentMatches } = React . useContext ( RouteContext ) ;
364363 let routeMatch = parentMatches [ parentMatches . length - 1 ] ;
365364 let parentParams = routeMatch ? routeMatch . params : { } ;
@@ -446,13 +445,7 @@ export function useRoutesImpl(
446445 remainingPathname = "/" + segments . slice ( parentSegments . length ) . join ( "/" ) ;
447446 }
448447
449- let matches =
450- ! isStatic &&
451- dataRouterState &&
452- dataRouterState . matches &&
453- dataRouterState . matches . length > 0
454- ? ( dataRouterState . matches as AgnosticRouteMatch < string , RouteObject > [ ] )
455- : matchRoutes ( routes , { pathname : remainingPathname } ) ;
448+ let matches = matchRoutes ( routes , { pathname : remainingPathname } ) ;
456449
457450 if ( __DEV__ ) {
458451 warning (
You can’t perform that action at this time.
0 commit comments