@tanstack/react-router 1.52.5 → 1.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +2 -2
- package/dist/cjs/path.cjs +1 -1
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +2 -1
- package/dist/cjs/router.cjs +4 -2
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/Matches.d.ts +2 -2
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/path.js +1 -1
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/route.d.ts +2 -1
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +4 -2
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/Matches.tsx +3 -3
- package/src/path.ts +1 -1
- package/src/route.ts +2 -1
- package/src/router.ts +2 -0
package/package.json
CHANGED
package/src/Matches.tsx
CHANGED
|
@@ -352,8 +352,8 @@ export function MatchRoute<
|
|
|
352
352
|
return params ? props.children : null
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
export type
|
|
356
|
-
TRouter extends AnyRouter =
|
|
355
|
+
export type MakeRouteMatchUnion<
|
|
356
|
+
TRouter extends AnyRouter = RegisteredRouter,
|
|
357
357
|
TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,
|
|
358
358
|
> = TRoute extends any
|
|
359
359
|
? RouteMatch<
|
|
@@ -369,7 +369,7 @@ export type MakeRouteMatches<
|
|
|
369
369
|
|
|
370
370
|
export function useMatches<
|
|
371
371
|
TRouter extends AnyRouter = RegisteredRouter,
|
|
372
|
-
TRouteMatch =
|
|
372
|
+
TRouteMatch = MakeRouteMatchUnion<TRouter>,
|
|
373
373
|
T = Array<TRouteMatch>,
|
|
374
374
|
>(opts?: { select?: (matches: Array<TRouteMatch>) => T }): T {
|
|
375
375
|
return useRouterState({
|
package/src/path.ts
CHANGED
package/src/route.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { rootRouteId } from './root'
|
|
|
11
11
|
import type * as React from 'react'
|
|
12
12
|
import type { RootRouteId } from './root'
|
|
13
13
|
import type { UseNavigateResult } from './useNavigate'
|
|
14
|
-
import type { MakeRouteMatch, RouteMatch } from './Matches'
|
|
14
|
+
import type { MakeRouteMatch, MakeRouteMatchUnion, RouteMatch } from './Matches'
|
|
15
15
|
import type { NavigateOptions, ParsePathParams, ToMaskOptions } from './link'
|
|
16
16
|
import type { ParsedLocation } from './location'
|
|
17
17
|
import type { RouteById, RouteIds, RoutePaths } from './routeInfo'
|
|
@@ -285,6 +285,7 @@ export interface ContextOptions<
|
|
|
285
285
|
navigate: NavigateFn
|
|
286
286
|
buildLocation: BuildLocationFn
|
|
287
287
|
cause: 'preload' | 'enter' | 'stay'
|
|
288
|
+
matches: Array<MakeRouteMatchUnion>
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
export interface RouteContextOptions<
|
package/src/router.ts
CHANGED
|
@@ -1264,6 +1264,7 @@ export class Router<
|
|
|
1264
1264
|
cause: match.cause,
|
|
1265
1265
|
abortController: match.abortController,
|
|
1266
1266
|
preload: !!match.preload,
|
|
1267
|
+
matches,
|
|
1267
1268
|
}
|
|
1268
1269
|
|
|
1269
1270
|
// Get the route context
|
|
@@ -2080,6 +2081,7 @@ export class Router<
|
|
|
2080
2081
|
this.navigate({ ...opts, _fromLocation: location }),
|
|
2081
2082
|
buildLocation: this.buildLocation,
|
|
2082
2083
|
cause: preload ? 'preload' : cause,
|
|
2084
|
+
matches,
|
|
2083
2085
|
}
|
|
2084
2086
|
|
|
2085
2087
|
let beforeLoadContext =
|