@tanstack/react-router 0.0.1-beta.269 → 0.0.1-beta.270

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.269",
4
+ "version": "0.0.1-beta.270",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "0.0.1-beta.269"
47
+ "@tanstack/history": "0.0.1-beta.270"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/Matches.tsx CHANGED
@@ -29,14 +29,12 @@ export interface RouteMatch<
29
29
  status: 'pending' | 'success' | 'error'
30
30
  isFetching: boolean
31
31
  showPending: boolean
32
- invalid: boolean
33
32
  error: unknown
34
33
  paramsError: unknown
35
34
  searchError: unknown
36
35
  updatedAt: number
37
36
  loadPromise?: Promise<void>
38
37
  loaderData?: RouteById<TRouteTree, TRouteId>['types']['loaderData']
39
- __resolveLoadPromise?: () => void
40
38
  routeContext: RouteById<TRouteTree, TRouteId>['types']['routeContext']
41
39
  context: RouteById<TRouteTree, TRouteId>['types']['allContext']
42
40
  search: FullSearchSchema<TRouteTree> &
@@ -56,26 +54,12 @@ export function Matches() {
56
54
  return getRenderedMatches(s)[0]?.id
57
55
  },
58
56
  })
59
- const route = router.routesById[rootRouteId]!
60
-
61
- const errorComponent = React.useCallback(
62
- (props: any) => {
63
- return React.createElement(ErrorComponent, {
64
- ...props,
65
- useMatch: route.useMatch,
66
- useRouteContext: route.useRouteContext,
67
- useSearch: route.useSearch,
68
- useParams: route.useParams,
69
- })
70
- },
71
- [route],
72
- )
73
57
 
74
58
  return (
75
59
  <matchContext.Provider value={matchId}>
76
60
  <CatchBoundary
77
61
  getResetKey={() => router.state.resolvedLocation.state?.key}
78
- errorComponent={errorComponent}
62
+ errorComponent={ErrorComponent}
79
63
  onCatch={() => {
80
64
  warning(
81
65
  false,
@@ -110,58 +94,41 @@ export function Match({ matchId }: { matchId: string }) {
110
94
  const PendingComponent = (route.options.pendingComponent ??
111
95
  router.options.defaultPendingComponent) as any
112
96
 
113
- const pendingElement = PendingComponent
114
- ? React.createElement(PendingComponent, {
115
- useMatch: route.useMatch,
116
- useRouteContext: route.useRouteContext,
117
- useSearch: route.useSearch,
118
- useParams: route.useParams,
119
- })
120
- : undefined
121
-
122
97
  const routeErrorComponent =
123
98
  route.options.errorComponent ??
124
99
  router.options.defaultErrorComponent ??
125
100
  ErrorComponent
126
101
 
127
102
  const ResolvedSuspenseBoundary =
128
- route.options.wrapInSuspense ?? pendingElement
103
+ route.options.wrapInSuspense ??
104
+ PendingComponent ??
105
+ route.options.component?.preload ??
106
+ route.options.pendingComponent?.preload ??
107
+ (route.options.errorComponent as any)?.preload
129
108
  ? React.Suspense
130
109
  : SafeFragment
131
110
 
132
- const errorComponent = routeErrorComponent
133
- ? React.useCallback(
134
- (props: any) => {
135
- return React.createElement(routeErrorComponent, {
136
- ...props,
137
- useMatch: route.useMatch,
138
- useRouteContext: route.useRouteContext,
139
- useSearch: route.useSearch,
140
- useParams: route.useParams,
141
- })
142
- },
143
- [route],
144
- )
145
- : undefined
146
-
147
- const ResolvedCatchBoundary = errorComponent ? CatchBoundary : SafeFragment
111
+ const ResolvedCatchBoundary = routeErrorComponent
112
+ ? CatchBoundary
113
+ : SafeFragment
148
114
 
149
115
  return (
150
116
  <matchContext.Provider value={matchId}>
151
- <ResolvedSuspenseBoundary fallback={pendingElement}>
117
+ <ResolvedSuspenseBoundary fallback={PendingComponent}>
152
118
  <ResolvedCatchBoundary
153
119
  getResetKey={() => router.state.resolvedLocation.state?.key}
154
- errorComponent={errorComponent}
120
+ errorComponent={routeErrorComponent}
155
121
  onCatch={() => {
156
122
  warning(false, `Error in route match: ${matchId}`)
157
123
  }}
158
124
  >
159
- <MatchInner matchId={matchId!} pendingElement={pendingElement} />
125
+ <MatchInner matchId={matchId!} pendingElement={PendingComponent} />
160
126
  </ResolvedCatchBoundary>
161
127
  </ResolvedSuspenseBoundary>
162
128
  </matchContext.Provider>
163
129
  )
164
130
  }
131
+
165
132
  function MatchInner({
166
133
  matchId,
167
134
  pendingElement,
@@ -199,16 +166,10 @@ function MatchInner({
199
166
  }
200
167
 
201
168
  if (match.status === 'success') {
202
- let comp = route.options.component ?? router.options.defaultComponent
203
-
204
- if (comp) {
205
- return React.createElement(comp, {
206
- useMatch: route.useMatch,
207
- useRouteContext: route.useRouteContext as any,
208
- useSearch: route.useSearch,
209
- useParams: route.useParams as any,
210
- useLoaderData: route.useLoaderData,
211
- })
169
+ let Comp = route.options.component ?? router.options.defaultComponent
170
+
171
+ if (Comp) {
172
+ return <Comp />
212
173
  }
213
174
 
214
175
  return <Outlet />
@@ -245,7 +206,7 @@ export interface MatchRouteOptions {
245
206
  fuzzy?: boolean
246
207
  }
247
208
 
248
- export type MakeUseMatchRouteOptions<
209
+ export type UseMatchRouteOptions<
249
210
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
250
211
  TFrom extends RoutePaths<TRouteTree> = '/',
251
212
  TTo extends string = '',
@@ -266,13 +227,7 @@ export function useMatchRoute<
266
227
  TMaskTo extends string = '',
267
228
  TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>,
268
229
  >(
269
- opts: MakeUseMatchRouteOptions<
270
- TRouteTree,
271
- TFrom,
272
- TTo,
273
- TMaskFrom,
274
- TMaskTo
275
- >,
230
+ opts: UseMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
276
231
  ): false | RouteById<TRouteTree, TResolved>['types']['allParams'] => {
277
232
  const { pending, caseSensitive, ...rest } = opts
278
233
 
@@ -393,11 +348,21 @@ export function useMatch<
393
348
  export function useMatches<T = RouteMatch[]>(opts?: {
394
349
  select?: (matches: RouteMatch[]) => T
395
350
  }): T {
396
- const contextMatchId = React.useContext(matchContext)
397
-
398
351
  return useRouterState({
399
352
  select: (state) => {
400
353
  let matches = getRenderedMatches(state)
354
+ return opts?.select ? opts.select(matches) : (matches as T)
355
+ },
356
+ })
357
+ }
358
+
359
+ export function useParentMatches<T = RouteMatch[]>(opts?: {
360
+ select?: (matches: RouteMatch[]) => T
361
+ }): T {
362
+ const contextMatchId = React.useContext(matchContext)
363
+
364
+ return useMatches({
365
+ select: (matches) => {
401
366
  matches = matches.slice(matches.findIndex((d) => d.id === contextMatchId))
402
367
  return opts?.select ? opts.select(matches) : (matches as T)
403
368
  },
package/src/fileRoute.ts CHANGED
@@ -124,12 +124,7 @@ export class FileRoute<
124
124
  >,
125
125
  'getParentRoute' | 'path' | 'id'
126
126
  > &
127
- UpdatableRouteOptions<
128
- TFullSearchSchema,
129
- TAllParams,
130
- TContext,
131
- TLoaderData
132
- >,
127
+ UpdatableRouteOptions<TFullSearchSchema>,
133
128
  ): Route<
134
129
  TParentRoute,
135
130
  TPath,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react'
2
- import { AsyncRouteComponent } from './route'
2
+ import { RouteComponent } from './route'
3
3
 
4
4
  export function lazyRouteComponent<
5
5
  T extends Record<string, any>,
@@ -7,9 +7,7 @@ export function lazyRouteComponent<
7
7
  >(
8
8
  importer: () => Promise<T>,
9
9
  exportName?: TKey,
10
- ): T[TKey] extends (props: infer TProps) => any
11
- ? AsyncRouteComponent<TProps>
12
- : never {
10
+ ): T[TKey] extends (props: any) => any ? RouteComponent : never {
13
11
  let loadPromise: Promise<any>
14
12
 
15
13
  const load = () => {
package/src/link.tsx CHANGED
@@ -2,7 +2,6 @@ import * as React from 'react'
2
2
  import { useMatch } from './Matches'
3
3
  import { useRouter, useRouterState } from './RouterProvider'
4
4
  import { Trim } from './fileRoute'
5
- import { LocationState } from './location'
6
5
  import { AnyRoute, ReactNode } from './route'
7
6
  import {
8
7
  AllParams,
@@ -12,7 +11,7 @@ import {
12
11
  RoutePaths,
13
12
  } from './routeInfo'
14
13
  import { RegisteredRouter } from './router'
15
- import { MakeLinkOptions, MakeLinkPropsOptions } from './useNavigate'
14
+ import { LinkProps, UseLinkPropsOptions } from './useNavigate'
16
15
  import {
17
16
  Expand,
18
17
  NoInfer,
@@ -23,6 +22,7 @@ import {
23
22
  deepEqual,
24
23
  functionalUpdate,
25
24
  } from './utils'
25
+ import { HistoryState } from '@tanstack/history'
26
26
 
27
27
  export type CleanPath<T extends string> = T extends `${infer L}//${infer R}`
28
28
  ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`>
@@ -156,7 +156,7 @@ export type ToSubOptions<
156
156
  // The new has string or a function to update it
157
157
  hash?: true | Updater<string>
158
158
  // State to pass to the history stack
159
- state?: true | NonNullableUpdater<LocationState>
159
+ state?: true | NonNullableUpdater<HistoryState>
160
160
  // The source route path. This is automatically set when using route-level APIs, but for type-safe relative routing on the router itself, this is required
161
161
  from?: TFrom
162
162
  // // When using relative route paths, this option forces resolution from the current path, instead of the route API's path or `from` path
@@ -348,7 +348,7 @@ export function useLinkProps<
348
348
  TMaskFrom extends RoutePaths<TRouteTree> = '/',
349
349
  TMaskTo extends string = '',
350
350
  >(
351
- options: MakeLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
351
+ options: UseLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
352
352
  ): React.AnchorHTMLAttributes<HTMLAnchorElement> {
353
353
  const router = useRouter()
354
354
  const matchPathname = useMatch({
@@ -568,7 +568,7 @@ export interface LinkComponent<TProps extends Record<string, any> = {}> {
568
568
  TMaskFrom extends RoutePaths<TRouteTree> = '/',
569
569
  TMaskTo extends string = '',
570
570
  >(
571
- props: MakeLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
571
+ props: LinkProps<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
572
572
  TProps &
573
573
  React.RefAttributes<HTMLAnchorElement>,
574
574
  ): ReactNode
package/src/location.ts CHANGED
@@ -11,5 +11,3 @@ export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
11
11
  maskedLocation?: ParsedLocation<TSearchObj>
12
12
  unmaskOnReload?: boolean
13
13
  }
14
-
15
- export interface LocationState {}
package/src/route.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { HistoryLocation } from '@tanstack/history'
2
1
  import * as React from 'react'
3
2
  import invariant from 'tiny-invariant'
4
3
  import { useLoaderData, useMatch } from './Matches'
@@ -76,12 +75,7 @@ export type RouteOptions<
76
75
  TAllContext,
77
76
  TLoaderData
78
77
  > &
79
- UpdatableRouteOptions<
80
- NoInfer<TFullSearchSchema>,
81
- NoInfer<TAllParams>,
82
- NoInfer<TAllContext>,
83
- NoInfer<TLoaderData>
84
- >
78
+ UpdatableRouteOptions<NoInfer<TFullSearchSchema>>
85
79
 
86
80
  export type ParamsFallback<
87
81
  TPath extends string,
@@ -182,9 +176,6 @@ type BeforeLoadFn<
182
176
 
183
177
  export type UpdatableRouteOptions<
184
178
  TFullSearchSchema extends Record<string, any>,
185
- TAllParams extends AnyPathParams,
186
- TAllContext extends AnyContext,
187
- TLoaderData extends any = unknown,
188
179
  > = MetaOptions & {
189
180
  // test?: (args: TAllContext) => void
190
181
  // If true, this route will be matched as case-sensitive
@@ -192,24 +183,9 @@ export type UpdatableRouteOptions<
192
183
  // If true, this route will be forcefully wrapped in a suspense boundary
193
184
  wrapInSuspense?: boolean
194
185
  // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
195
- component?: RouteComponent<
196
- TFullSearchSchema,
197
- TAllParams,
198
- TAllContext,
199
- TLoaderData
200
- >
201
- // The content to be rendered when the route encounters an error
202
- errorComponent?: ErrorRouteComponent<
203
- TFullSearchSchema,
204
- TAllParams,
205
- TAllContext // NOTE: This used to break the universe.... but it seems to work now?
206
- > //
207
- // If supported by your framework, the content to be rendered as the fallback content until the route is ready to render
208
- pendingComponent?: PendingRouteComponent<
209
- TFullSearchSchema,
210
- TAllParams,
211
- TAllContext
212
- >
186
+ component?: RouteComponent
187
+ errorComponent?: false | null | RouteComponent
188
+ pendingComponent?: RouteComponent
213
189
  pendingMs?: number
214
190
  pendingMinMs?: number
215
191
  // Filter functions that can manipulate search params *before* they are passed to links and navigate
@@ -222,7 +198,7 @@ export type UpdatableRouteOptions<
222
198
  // These functions are called as route matches are loaded, stick around and leave the active
223
199
  // matches
224
200
  onEnter?: (match: AnyRouteMatch) => void
225
- onTransition?: (match: AnyRouteMatch) => void
201
+ onStay?: (match: AnyRouteMatch) => void
226
202
  onLeave?: (match: AnyRouteMatch) => void
227
203
  }
228
204
 
@@ -337,13 +313,6 @@ export interface AnyRoute
337
313
 
338
314
  export type MergeFromFromParent<T, U> = IsAny<T, U, T & U>
339
315
 
340
- export type StreamedPromise<T> = {
341
- promise: Promise<T>
342
- status: 'resolved' | 'pending'
343
- data: T
344
- resolve: (value: T) => void
345
- }
346
-
347
316
  export type ResolveAllParams<
348
317
  TParentRoute extends AnyRoute,
349
318
  TParams extends AnyPathParams,
@@ -623,16 +592,7 @@ export class Route<
623
592
  return this as any
624
593
  }
625
594
 
626
- update = (
627
- options: UpdatableRouteOptions<
628
- TFullSearchSchema,
629
- TAllParams,
630
- Expand<
631
- Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>
632
- >,
633
- TLoaderData
634
- >,
635
- ) => {
595
+ update = (options: UpdatableRouteOptions<TFullSearchSchema>) => {
636
596
  Object.assign(this.options, options)
637
597
  return this
638
598
  }
@@ -813,29 +773,6 @@ export function createRouteMask<
813
773
  return opts as any
814
774
  }
815
775
 
816
- export type RouteProps<
817
- TFullSearchSchema extends Record<string, any> = AnySearchSchema,
818
- TAllParams extends AnyPathParams = AnyPathParams,
819
- TAllContext extends Record<string, any> = AnyContext,
820
- TLoaderData extends any = unknown,
821
- > = {
822
- useMatch: <TSelected = TAllContext>(opts?: {
823
- select?: (search: TAllContext) => TSelected
824
- }) => TSelected
825
- useRouteContext: <TSelected = TAllContext>(opts?: {
826
- select?: (search: TAllContext) => TSelected
827
- }) => TSelected
828
- useSearch: <TSelected = TFullSearchSchema>(opts?: {
829
- select?: (search: TFullSearchSchema) => TSelected
830
- }) => TSelected
831
- useParams: <TSelected = TAllParams>(opts?: {
832
- select?: (search: TAllParams) => TSelected
833
- }) => TSelected
834
- useLoaderData: <TSelected = TLoaderData>(opts?: {
835
- select?: (search: TLoaderData) => TSelected
836
- }) => TSelected
837
- }
838
-
839
776
  export type ErrorRouteProps<
840
777
  TFullSearchSchema extends Record<string, any> = AnySearchSchema,
841
778
  TAllParams extends AnyPathParams = AnyPathParams,
@@ -843,74 +780,19 @@ export type ErrorRouteProps<
843
780
  > = {
844
781
  error: unknown
845
782
  info: { componentStack: string }
846
- } & RouteProps<TFullSearchSchema, TAllParams, TAllContext>
847
-
848
- export type PendingRouteProps<
849
- TFullSearchSchema extends Record<string, any> = AnySearchSchema,
850
- TAllParams extends AnyPathParams = AnyPathParams,
851
- TAllContext extends Record<string, any> = AnyContext,
852
- > = RouteProps<TFullSearchSchema, TAllParams, TAllContext>
783
+ }
853
784
  //
854
785
 
855
786
  export type ReactNode = any
856
787
 
857
- export type SyncRouteComponent<TProps> =
858
- | ((props: TProps) => ReactNode)
859
- | React.LazyExoticComponent<(props: TProps) => ReactNode>
788
+ export type SyncRouteComponent =
789
+ | (() => JSX.Element)
790
+ | React.LazyExoticComponent<() => JSX.Element>
860
791
 
861
- export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
792
+ export type RouteComponent = SyncRouteComponent & {
862
793
  preload?: () => Promise<void>
863
794
  }
864
795
 
865
- export type RouteComponent<
866
- TFullSearchSchema extends Record<string, any>,
867
- TAllParams extends AnyPathParams,
868
- TAllContext extends Record<string, any>,
869
- TLoaderData extends any = unknown,
870
- > = AsyncRouteComponent<
871
- RouteProps<TFullSearchSchema, TAllParams, TAllContext, TLoaderData>
872
- >
873
-
874
- export type ErrorRouteComponent<
875
- TFullSearchSchema extends Record<string, any>,
876
- TAllParams extends AnyPathParams,
877
- TAllContext extends Record<string, any>,
878
- > = AsyncRouteComponent<
879
- ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>
880
- >
881
-
882
- export type PendingRouteComponent<
883
- TFullSearchSchema extends Record<string, any>,
884
- TAllParams extends AnyPathParams,
885
- TAllContext extends Record<string, any>,
886
- > = AsyncRouteComponent<
887
- PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>
888
- >
889
-
890
- export type AnyRouteComponent = RouteComponent<any, any, any, any>
891
-
892
- export type ComponentPropsFromRoute<TRoute> =
893
- TRoute extends (() => infer T extends AnyRoute)
894
- ? ComponentPropsFromRoute<T>
895
- : TRoute extends Route<
896
- infer TParentRoute,
897
- infer TPath,
898
- infer TFullPath,
899
- infer TCustomId,
900
- infer TId,
901
- infer TSearchSchema,
902
- infer TFullSearchSchema,
903
- infer TParams,
904
- infer TAllParams,
905
- infer TRouteContext,
906
- infer TAllContext,
907
- infer TRouterContext,
908
- infer TLoaderData,
909
- infer TChildren
910
- >
911
- ? RouteProps<TFullSearchSchema, TAllParams, TAllContext, TLoaderData>
912
- : {}
913
-
914
796
  export class NotFoundRoute<
915
797
  TParentRoute extends AnyRootRoute,
916
798
  TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
package/src/router.ts CHANGED
@@ -32,14 +32,9 @@ import {
32
32
  pick,
33
33
  Timeout,
34
34
  } from './utils'
35
- import {
36
- ErrorRouteComponent,
37
- PendingRouteComponent,
38
- RouteComponent,
39
- } from './route'
35
+ import { RouteComponent } from './route'
40
36
  import { AnyRouteMatch, RouteMatch } from './Matches'
41
37
  import { ParsedLocation } from './location'
42
- import { LocationState } from './location'
43
38
  import { SearchSerializer, SearchParser } from './searchParams'
44
39
  import {
45
40
  BuildLocationFn,
@@ -110,17 +105,9 @@ export interface RouterOptions<
110
105
  parseSearch?: SearchParser
111
106
  defaultPreload?: false | 'intent'
112
107
  defaultPreloadDelay?: number
113
- defaultComponent?: RouteComponent<AnySearchSchema, AnyPathParams, AnyContext>
114
- defaultErrorComponent?: ErrorRouteComponent<
115
- AnySearchSchema,
116
- AnyPathParams,
117
- AnyContext
118
- >
119
- defaultPendingComponent?: PendingRouteComponent<
120
- AnySearchSchema,
121
- AnyPathParams,
122
- AnyContext
123
- >
108
+ defaultComponent?: RouteComponent
109
+ defaultErrorComponent?: RouteComponent
110
+ defaultPendingComponent?: RouteComponent
124
111
  defaultPendingMs?: number
125
112
  defaultPendingMinMs?: number
126
113
  caseSensitive?: boolean
@@ -153,13 +140,13 @@ export interface BuildNextOptions {
153
140
  params?: true | Updater<unknown>
154
141
  search?: true | Updater<unknown>
155
142
  hash?: true | Updater<string>
156
- state?: true | NonNullableUpdater<LocationState>
143
+ state?: true | NonNullableUpdater<HistoryState>
157
144
  mask?: {
158
145
  to?: string | number | null
159
146
  params?: true | Updater<unknown>
160
147
  search?: true | Updater<unknown>
161
148
  hash?: true | Updater<string>
162
- state?: true | NonNullableUpdater<LocationState>
149
+ state?: true | NonNullableUpdater<HistoryState>
163
150
  unmaskOnReload?: boolean
164
151
  }
165
152
  from?: string
@@ -171,7 +158,7 @@ export interface DehydratedRouterState {
171
158
 
172
159
  export type DehydratedRouteMatch = Pick<
173
160
  RouteMatch,
174
- 'fetchedAt' | 'invalid' | 'id' | 'status' | 'updatedAt'
161
+ 'fetchedAt' | 'id' | 'status' | 'updatedAt'
175
162
  >
176
163
 
177
164
  export interface DehydratedRouter {
@@ -663,7 +650,6 @@ export class Router<
663
650
  status: hasLoaders ? 'pending' : 'success',
664
651
  showPending: false,
665
652
  isFetching: false,
666
- invalid: false,
667
653
  error: undefined,
668
654
  paramsError: parseErrors[index],
669
655
  loadPromise: Promise.resolve(),
@@ -1115,7 +1101,6 @@ export class Router<
1115
1101
  matches[index] = match = {
1116
1102
  ...match,
1117
1103
  fetchedAt: Date.now(),
1118
- invalid: false,
1119
1104
  showPending: false,
1120
1105
  }
1121
1106
 
@@ -1385,7 +1370,7 @@ export class Router<
1385
1370
  [
1386
1371
  [exitingMatchIds, 'onLeave'],
1387
1372
  [enteringMatchIds, 'onEnter'],
1388
- [stayingMatchIds, 'onTransition'],
1373
+ [stayingMatchIds, 'onStay'],
1389
1374
  ] as const
1390
1375
  ).forEach(([matches, hook]) => {
1391
1376
  matches.forEach((match) => {
@@ -1514,14 +1499,7 @@ export class Router<
1514
1499
  return {
1515
1500
  state: {
1516
1501
  dehydratedMatches: this.state.matches.map((d) =>
1517
- pick(d, [
1518
- 'fetchedAt',
1519
- 'invalid',
1520
- 'id',
1521
- 'status',
1522
- 'updatedAt',
1523
- 'loaderData',
1524
- ]),
1502
+ pick(d, ['fetchedAt', 'id', 'status', 'updatedAt', 'loaderData']),
1525
1503
  ),
1526
1504
  },
1527
1505
  }
@@ -35,19 +35,20 @@ export function useNavigate<
35
35
  )
36
36
  }
37
37
 
38
- export function typedNavigate<
39
- TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
40
- TDefaultFrom extends RoutePaths<TRouteTree> = '/',
41
- >(navigate: (opts: NavigateOptions<any>) => Promise<void>) {
42
- return navigate as <
43
- TFrom extends RoutePaths<TRouteTree> = TDefaultFrom,
44
- TTo extends string = '',
45
- TMaskFrom extends RoutePaths<TRouteTree> = '/',
46
- TMaskTo extends string = '',
47
- >(
48
- opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
49
- ) => Promise<void>
50
- } //
38
+ // NOTE: I don't know of anyone using this. It's undocumented, so let's wait until someone needs it
39
+ // export function typedNavigate<
40
+ // TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
41
+ // TDefaultFrom extends RoutePaths<TRouteTree> = '/',
42
+ // >(navigate: (opts: NavigateOptions<any>) => Promise<void>) {
43
+ // return navigate as <
44
+ // TFrom extends RoutePaths<TRouteTree> = TDefaultFrom,
45
+ // TTo extends string = '',
46
+ // TMaskFrom extends RoutePaths<TRouteTree> = '/',
47
+ // TMaskTo extends string = '',
48
+ // >(
49
+ // opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
50
+ // ) => Promise<void>
51
+ // } //
51
52
 
52
53
  export function Navigate<
53
54
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
@@ -69,22 +70,22 @@ export function Navigate<
69
70
  return null
70
71
  }
71
72
 
72
- export type MakeLinkPropsOptions<
73
+ export type UseLinkPropsOptions<
73
74
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
74
75
  TFrom extends RoutePaths<TRouteTree> = '/',
75
76
  TTo extends string = '',
76
77
  TMaskFrom extends RoutePaths<TRouteTree> = '/',
77
78
  TMaskTo extends string = '',
78
- > = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
79
+ > = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
79
80
  React.AnchorHTMLAttributes<HTMLAnchorElement>
80
81
 
81
- export type MakeLinkOptions<
82
+ export type LinkProps<
82
83
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
83
84
  TFrom extends RoutePaths<TRouteTree> = '/',
84
85
  TTo extends string = '',
85
86
  TMaskFrom extends RoutePaths<TRouteTree> = '/',
86
87
  TMaskTo extends string = '',
87
- > = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
88
+ > = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
88
89
  Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
89
90
  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns
90
91
  children?:
@@ -92,7 +93,7 @@ export type MakeLinkOptions<
92
93
  | ((state: { isActive: boolean }) => React.ReactNode)
93
94
  }
94
95
 
95
- export type LinkPropsOptions<
96
+ export type ActiveLinkOptions<
96
97
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
97
98
  TFrom extends RoutePaths<TRouteTree> = '/',
98
99
  TTo extends string = '',