File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
packages/react-router/lib Expand file tree Collapse file tree 2 files changed +7
-9
lines changed 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 1
1
import * as React from "react" ;
2
2
import type {
3
- AgnosticRouteMatch ,
4
3
Blocker ,
5
4
BlockerFunction ,
6
5
Location ,
@@ -359,7 +358,7 @@ export function useRoutesImpl(
359
358
`useRoutes() may be used only in the context of a <Router> component.`
360
359
) ;
361
360
362
- let { navigator, static : isStatic } = React . useContext ( NavigationContext ) ;
361
+ let { navigator } = React . useContext ( NavigationContext ) ;
363
362
let { matches : parentMatches } = React . useContext ( RouteContext ) ;
364
363
let routeMatch = parentMatches [ parentMatches . length - 1 ] ;
365
364
let parentParams = routeMatch ? routeMatch . params : { } ;
@@ -446,13 +445,7 @@ export function useRoutesImpl(
446
445
remainingPathname = "/" + segments . slice ( parentSegments . length ) . join ( "/" ) ;
447
446
}
448
447
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 } ) ;
456
449
457
450
if ( __DEV__ ) {
458
451
warning (
You can’t perform that action at this time.
0 commit comments