@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/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +1 -0
- package/dist/cjs/Transitioner.cjs +3 -3
- package/dist/cjs/Transitioner.cjs.map +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +2 -2
- package/dist/cjs/router.cjs +1 -0
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/Matches.d.ts +1 -0
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/Transitioner.js +3 -3
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/esm/route.d.ts +2 -2
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +1 -0
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/Matches.tsx +10 -0
- package/src/Transitioner.tsx +3 -3
- package/src/route.ts +7 -2
- package/src/router.ts +2 -1
package/package.json
CHANGED
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/Transitioner.tsx
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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 {
|
|
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<
|
|
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<
|
|
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
|
})
|