@tanstack/react-router 1.77.4 → 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.4",
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,
@@ -84,7 +84,7 @@ export function Transitioner() {
84
84
  if (previousIsLoading && !routerState.isLoading) {
85
85
  const toLocation = router.state.location
86
86
  const fromLocation = router.state.resolvedLocation
87
- const pathChanged = fromLocation.href !== toLocation.href
87
+ const pathChanged = fromLocation.pathname !== toLocation.pathname
88
88
 
89
89
  router.emit({
90
90
  type: 'onLoad', // When the new URL has committed, when the new matches have been loaded into state.matches
@@ -100,7 +100,7 @@ export function Transitioner() {
100
100
  if (previousIsPagePending && !isPagePending) {
101
101
  const toLocation = router.state.location
102
102
  const fromLocation = router.state.resolvedLocation
103
- const pathChanged = fromLocation.href !== toLocation.href
103
+ const pathChanged = fromLocation.pathname !== toLocation.pathname
104
104
 
105
105
  router.emit({
106
106
  type: 'onBeforeRouteMount',
@@ -116,7 +116,7 @@ export function Transitioner() {
116
116
  if (previousIsAnyPending && !isAnyPending) {
117
117
  const toLocation = router.state.location
118
118
  const fromLocation = router.state.resolvedLocation
119
- const pathChanged = fromLocation.href !== toLocation.href
119
+ const pathChanged = fromLocation.pathname !== toLocation.pathname
120
120
 
121
121
  router.emit({
122
122
  type: 'onResolved',
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
  })