@tanstack/react-router 1.77.7 → 1.77.9

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.7",
3
+ "version": "1.77.9",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/fileRoute.ts CHANGED
@@ -100,6 +100,7 @@ export class FileRoute<
100
100
  >(
101
101
  options?: FileBaseRouteOptions<
102
102
  TParentRoute,
103
+ TId,
103
104
  TPath,
104
105
  TSearchValidator,
105
106
  TParams,
@@ -161,6 +162,7 @@ export function FileRouteLoader<
161
162
  TLoaderFn,
162
163
  RouteLoaderFn<
163
164
  TRoute['parentRoute'],
165
+ TRoute['types']['id'],
164
166
  TRoute['types']['params'],
165
167
  TRoute['types']['loaderDeps'],
166
168
  TRoute['types']['routerContext'],
package/src/index.tsx CHANGED
@@ -73,6 +73,7 @@ export type {
73
73
  ActiveLinkOptions,
74
74
  LinkProps,
75
75
  LinkComponent,
76
+ LinkComponentProps,
76
77
  CreateLinkProps,
77
78
  MakeOptionalPathParams,
78
79
  } from './link'
package/src/route.ts CHANGED
@@ -57,6 +57,7 @@ export type RoutePathOptionsIntersection<TCustomId, TPath> = {
57
57
 
58
58
  export type RouteOptions<
59
59
  TParentRoute extends AnyRoute = AnyRoute,
60
+ TId extends string = string,
60
61
  TCustomId extends string = string,
61
62
  TFullPath extends string = string,
62
63
  TPath extends string = string,
@@ -69,6 +70,7 @@ export type RouteOptions<
69
70
  TBeforeLoadFn = AnyContext,
70
71
  > = BaseRouteOptions<
71
72
  TParentRoute,
73
+ TId,
72
74
  TCustomId,
73
75
  TPath,
74
76
  TSearchValidator,
@@ -173,6 +175,7 @@ export type BeforeLoadFn<
173
175
 
174
176
  export type FileBaseRouteOptions<
175
177
  TParentRoute extends AnyRoute = AnyRoute,
178
+ TId extends string = string,
176
179
  TPath extends string = string,
177
180
  TSearchValidator = undefined,
178
181
  TParams = {},
@@ -193,6 +196,7 @@ export type FileBaseRouteOptions<
193
196
  | ((
194
197
  match: LoaderFnContext<
195
198
  TParentRoute,
199
+ TId,
196
200
  TParams,
197
201
  TLoaderDeps,
198
202
  TRouterContext,
@@ -239,6 +243,7 @@ export type FileBaseRouteOptions<
239
243
  (
240
244
  ctx: LoaderFnContext<
241
245
  TParentRoute,
246
+ TId,
242
247
  TParams,
243
248
  TLoaderDeps,
244
249
  TRouterContext,
@@ -251,6 +256,7 @@ export type FileBaseRouteOptions<
251
256
 
252
257
  export type BaseRouteOptions<
253
258
  TParentRoute extends AnyRoute = AnyRoute,
259
+ TId extends string = string,
254
260
  TCustomId extends string = string,
255
261
  TPath extends string = string,
256
262
  TSearchValidator = undefined,
@@ -263,6 +269,7 @@ export type BaseRouteOptions<
263
269
  > = RoutePathOptions<TCustomId, TPath> &
264
270
  FileBaseRouteOptions<
265
271
  TParentRoute,
272
+ TId,
266
273
  TPath,
267
274
  TSearchValidator,
268
275
  TParams,
@@ -555,6 +562,7 @@ export type DefaultSearchValidator = SearchValidator<
555
562
 
556
563
  export type RouteLoaderFn<
557
564
  in out TParentRoute extends AnyRoute = AnyRoute,
565
+ in out TId extends string = string,
558
566
  in out TParams = {},
559
567
  in out TLoaderDeps = {},
560
568
  in out TRouterContext = {},
@@ -563,6 +571,7 @@ export type RouteLoaderFn<
563
571
  > = (
564
572
  match: LoaderFnContext<
565
573
  TParentRoute,
574
+ TId,
566
575
  TParams,
567
576
  TLoaderDeps,
568
577
  TRouterContext,
@@ -573,6 +582,7 @@ export type RouteLoaderFn<
573
582
 
574
583
  export interface LoaderFnContext<
575
584
  in out TParentRoute extends AnyRoute = AnyRoute,
585
+ in out TId extends string = string,
576
586
  in out TParams = {},
577
587
  in out TLoaderDeps = {},
578
588
  in out TRouterContext = {},
@@ -596,7 +606,10 @@ export interface LoaderFnContext<
596
606
  * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
597
607
  **/
598
608
  navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void>
599
- parentMatchPromise?: Promise<MakeRouteMatchFromRoute<TParentRoute>>
609
+ // root route does not have a parent match
610
+ parentMatchPromise: TId extends RootRouteId
611
+ ? never
612
+ : Promise<MakeRouteMatchFromRoute<TParentRoute>>
600
613
  cause: 'preload' | 'enter' | 'stay'
601
614
  route: Route
602
615
  }
@@ -925,6 +938,7 @@ export class Route<
925
938
  isRoot: TParentRoute extends Route<any> ? true : false
926
939
  options: RouteOptions<
927
940
  TParentRoute,
941
+ TId,
928
942
  TCustomId,
929
943
  TFullPath,
930
944
  TPath,
@@ -997,6 +1011,7 @@ export class Route<
997
1011
  constructor(
998
1012
  options?: RouteOptions<
999
1013
  TParentRoute,
1014
+ TId,
1000
1015
  TCustomId,
1001
1016
  TFullPath,
1002
1017
  TPath,
@@ -1057,6 +1072,7 @@ export class Route<
1057
1072
  const options = this.options as
1058
1073
  | (RouteOptions<
1059
1074
  TParentRoute,
1075
+ TId,
1060
1076
  TCustomId,
1061
1077
  TFullPath,
1062
1078
  TPath,
@@ -1192,6 +1208,7 @@ export class Route<
1192
1208
  TNewLoaderFn,
1193
1209
  RouteLoaderFn<
1194
1210
  TParentRoute,
1211
+ TCustomId,
1195
1212
  TParams,
1196
1213
  TLoaderDeps,
1197
1214
  TRouterContext,
@@ -1340,6 +1357,7 @@ export function createRoute<
1340
1357
  >(
1341
1358
  options: RouteOptions<
1342
1359
  TParentRoute,
1360
+ TId,
1343
1361
  TCustomId,
1344
1362
  TFullPath,
1345
1363
  TPath,
@@ -1381,8 +1399,9 @@ export type RootRouteOptions<
1381
1399
  > = Omit<
1382
1400
  RouteOptions<
1383
1401
  any, // TParentRoute
1384
- RootRouteId,
1385
- '', // TCustomId
1402
+ RootRouteId, // TId
1403
+ RootRouteId, // TCustomId
1404
+ '', // TFullPath
1386
1405
  '', // TPath
1387
1406
  TSearchValidator,
1388
1407
  {}, // TParams
@@ -1696,6 +1715,7 @@ export class NotFoundRoute<
1696
1715
  string,
1697
1716
  string,
1698
1717
  string,
1718
+ string,
1699
1719
  TSearchValidator,
1700
1720
  {},
1701
1721
  TLoaderDeps,
package/src/router.ts CHANGED
@@ -2310,7 +2310,7 @@ export class Router<
2310
2310
  if (prevLoaderPromise) {
2311
2311
  await prevLoaderPromise
2312
2312
  } else {
2313
- const parentMatchPromise = matchPromises[index - 1]
2313
+ const parentMatchPromise = matchPromises[index - 1] as any
2314
2314
  const route = this.looseRoutesById[routeId]!
2315
2315
 
2316
2316
  const getLoaderContext = (): LoaderFnContext => {