@tanstack/react-router 1.77.5 → 1.77.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.77.5",
3
+ "version": "1.77.6",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/Matches.tsx CHANGED
@@ -121,6 +121,16 @@ export const isMatch = <TMatch, TPath extends string>(
121
121
  return value != null
122
122
  }
123
123
 
124
+ export type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<
125
+ TRoute['types']['id'],
126
+ TRoute['types']['fullPath'],
127
+ TRoute['types']['allParams'],
128
+ TRoute['types']['fullSearchSchema'],
129
+ TRoute['types']['loaderData'],
130
+ TRoute['types']['allContext'],
131
+ TRoute['types']['loaderDeps']
132
+ >
133
+
124
134
  export interface RouteMatch<
125
135
  TRouteId,
126
136
  TFullPath,
package/src/route.ts CHANGED
@@ -11,7 +11,12 @@ 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, MakeRouteMatchUnion, RouteMatch } from './Matches'
14
+ import type {
15
+ MakeRouteMatch,
16
+ MakeRouteMatchFromRoute,
17
+ MakeRouteMatchUnion,
18
+ RouteMatch,
19
+ } from './Matches'
15
20
  import type { NavigateOptions, ParsePathParams, ToMaskOptions } from './link'
16
21
  import type { ParsedLocation } from './location'
17
22
  import type { RouteById, RouteIds, RoutePaths } from './routeInfo'
@@ -591,7 +596,7 @@ export interface LoaderFnContext<
591
596
  * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
592
597
  **/
593
598
  navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>
594
- parentMatchPromise?: Promise<void>
599
+ parentMatchPromise?: Promise<MakeRouteMatchFromRoute<TParentRoute>>
595
600
  cause: 'preload' | 'enter' | 'stay'
596
601
  route: Route
597
602
  }
package/src/router.ts CHANGED
@@ -2299,7 +2299,7 @@ export class Router<
2299
2299
  }
2300
2300
 
2301
2301
  const validResolvedMatches = matches.slice(0, firstBadMatchIndex)
2302
- const matchPromises: Array<Promise<any>> = []
2302
+ const matchPromises: Array<Promise<AnyRouteMatch>> = []
2303
2303
 
2304
2304
  validResolvedMatches.forEach(({ id: matchId, routeId }, index) => {
2305
2305
  matchPromises.push(
@@ -2535,6 +2535,7 @@ export class Router<
2535
2535
  loaderPromise: undefined,
2536
2536
  invalid: false,
2537
2537
  }))
2538
+ return this.getMatch(matchId)!
2538
2539
  })(),
2539
2540
  )
2540
2541
  })