@tanstack/router-core 0.0.1-beta.14 → 0.0.1-beta.16
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/build/cjs/packages/router-core/src/routeConfig.js.map +1 -1
- package/build/cjs/packages/router-core/src/routeMatch.js +6 -1
- package/build/cjs/packages/router-core/src/routeMatch.js.map +1 -1
- package/build/cjs/packages/router-core/src/router.js +3 -2
- package/build/cjs/packages/router-core/src/router.js.map +1 -1
- package/build/esm/index.js +9 -3
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +130 -130
- package/build/types/index.d.ts +25 -20
- package/build/umd/index.development.js +9 -3
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/link.ts +3 -1
- package/src/routeConfig.ts +35 -10
- package/src/routeInfo.ts +7 -0
- package/src/routeMatch.ts +9 -2
- package/src/router.ts +3 -0
package/build/types/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
39
39
|
pendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
40
40
|
loadPromise?: Promise<void>;
|
|
41
41
|
componentsPromise?: Promise<void>;
|
|
42
|
-
dataPromise?: Promise<
|
|
42
|
+
dataPromise?: Promise<TRouteInfo['routeLoaderData']>;
|
|
43
43
|
onExit?: void | ((matchContext: {
|
|
44
44
|
params: TRouteInfo['allParams'];
|
|
45
45
|
search: TRouteInfo['fullSearchSchema'];
|
|
@@ -67,6 +67,7 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
67
67
|
hasLoaders: () => boolean;
|
|
68
68
|
}
|
|
69
69
|
declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
|
|
70
|
+
parentMatch?: RouteMatch<any, any>;
|
|
70
71
|
matchId: string;
|
|
71
72
|
params: TRouteInfo['allParams'];
|
|
72
73
|
pathname: string;
|
|
@@ -220,6 +221,7 @@ interface BuildNextOptions {
|
|
|
220
221
|
params?: true | Updater<Record<string, any>>;
|
|
221
222
|
search?: true | Updater<unknown>;
|
|
222
223
|
hash?: true | Updater<string>;
|
|
224
|
+
state?: LocationState;
|
|
223
225
|
key?: string;
|
|
224
226
|
from?: string;
|
|
225
227
|
fromCurrent?: boolean;
|
|
@@ -354,8 +356,8 @@ declare type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteCon
|
|
|
354
356
|
declare type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
|
|
355
357
|
id: TId;
|
|
356
358
|
} extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
|
|
357
|
-
declare type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TRouteLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
|
|
358
|
-
interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
|
|
359
|
+
declare type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TParentLoaderData, infer TRouteLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TParentLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
|
|
360
|
+
interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
|
|
359
361
|
[TInfo in TRouteInfo as TInfo['id']]: TInfo;
|
|
360
362
|
}, TRouteInfoByFullPath = {
|
|
361
363
|
[TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId ? never : string extends TInfo['fullPath'] ? never : TInfo['fullPath']]: TInfo;
|
|
@@ -367,13 +369,14 @@ interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extend
|
|
|
367
369
|
routeIds: keyof TRouteInfoById;
|
|
368
370
|
routePaths: keyof TRouteInfoByFullPath;
|
|
369
371
|
}
|
|
370
|
-
interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
372
|
+
interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
371
373
|
}
|
|
372
|
-
interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> {
|
|
374
|
+
interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> {
|
|
373
375
|
id: TId;
|
|
374
376
|
routeId: TRouteId;
|
|
375
377
|
path: TPath;
|
|
376
378
|
fullPath: TFullPath;
|
|
379
|
+
parentRouteLoaderData: TParentRouteLoaderData;
|
|
377
380
|
routeLoaderData: TRouteLoaderData;
|
|
378
381
|
loaderData: TLoaderData;
|
|
379
382
|
actionPayload: TActionPayload;
|
|
@@ -383,7 +386,7 @@ interface RouteInfo<TId extends string = string, TRouteId extends string = strin
|
|
|
383
386
|
parentParams: TParentParams;
|
|
384
387
|
params: TParams;
|
|
385
388
|
allParams: TAllParams;
|
|
386
|
-
options: RouteOptions<TRouteId, TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
389
|
+
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
387
390
|
}
|
|
388
391
|
declare type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
|
|
389
392
|
[K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
|
|
@@ -410,15 +413,16 @@ declare type DefinedPathParamWarning = 'Path params cannot be redefined by child
|
|
|
410
413
|
declare type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
411
414
|
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
412
415
|
};
|
|
413
|
-
declare type LoaderFn<TRouteLoaderData extends AnyLoaderData, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TFullSearchSchema, TAllParams>) => Promise<TRouteLoaderData>;
|
|
414
|
-
interface LoaderContext<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
416
|
+
declare type LoaderFn<TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TParentRouteLoaderData, TFullSearchSchema, TAllParams>) => Promise<TRouteLoaderData>;
|
|
417
|
+
interface LoaderContext<TParentRouteLoaderData extends AnyLoaderData = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
415
418
|
params: TAllParams;
|
|
416
419
|
search: TFullSearchSchema;
|
|
417
420
|
signal?: AbortSignal;
|
|
421
|
+
parentLoaderPromise?: Promise<TParentRouteLoaderData>;
|
|
418
422
|
}
|
|
419
423
|
declare type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (submission: TActionPayload) => TActionResponse | Promise<TActionResponse>;
|
|
420
424
|
declare type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, RouteInfo<string, TPath>>) => void;
|
|
421
|
-
declare type RouteOptions<TRouteId extends string = string, TPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
|
|
425
|
+
declare type RouteOptions<TRouteId extends string = string, TPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
|
|
422
426
|
path: TPath;
|
|
423
427
|
} | {
|
|
424
428
|
id: TRouteId;
|
|
@@ -430,7 +434,7 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
|
|
|
430
434
|
component?: GetFrameworkGeneric<'Component'>;
|
|
431
435
|
errorComponent?: GetFrameworkGeneric<'Component'>;
|
|
432
436
|
pendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
433
|
-
loader?: LoaderFn<TRouteLoaderData, TFullSearchSchema, TAllParams>;
|
|
437
|
+
loader?: LoaderFn<TParentRouteLoaderData, TRouteLoaderData, TFullSearchSchema, TAllParams>;
|
|
434
438
|
loaderMaxAge?: number;
|
|
435
439
|
loaderGcMaxAge?: number;
|
|
436
440
|
action?: ActionFn<TActionPayload, TActionResponse>;
|
|
@@ -455,31 +459,31 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
|
|
|
455
459
|
stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
|
|
456
460
|
}) & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
|
|
457
461
|
declare type SearchFilter<T, U = T> = (prev: T) => U;
|
|
458
|
-
interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
|
|
462
|
+
interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
|
|
459
463
|
id: TId;
|
|
460
464
|
routeId: TRouteId;
|
|
461
465
|
path: NoInfer<TPath>;
|
|
462
466
|
fullPath: TFullPath;
|
|
463
|
-
options: RouteOptions<TRouteId, TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
467
|
+
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
464
468
|
children?: TKnownChildren;
|
|
465
469
|
addChildren: IsAny<TId, any, <TNewChildren extends any>(children: TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
|
|
466
470
|
error: 'Invalid route detected';
|
|
467
471
|
route: TNewChildren;
|
|
468
|
-
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
469
|
-
createChildren: IsAny<TId, any, <TNewChildren extends any>(cb: (createChildRoute: CreateRouteConfigFn<false, TId, TFullPath, TLoaderData, TFullSearchSchema, TAllParams>) => TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
|
|
472
|
+
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
473
|
+
createChildren: IsAny<TId, any, <TNewChildren extends any>(cb: (createChildRoute: CreateRouteConfigFn<false, TId, TFullPath, TRouteLoaderData, TLoaderData, TFullSearchSchema, TAllParams>) => TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
|
|
470
474
|
error: 'Invalid route detected';
|
|
471
475
|
route: TNewChildren;
|
|
472
|
-
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
473
|
-
createRoute: CreateRouteConfigFn<false, TId, TFullPath, TLoaderData, TFullSearchSchema, TAllParams>;
|
|
476
|
+
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
477
|
+
createRoute: CreateRouteConfigFn<false, TId, TFullPath, TRouteLoaderData, TLoaderData, TFullSearchSchema, TAllParams>;
|
|
474
478
|
}
|
|
475
|
-
declare type CreateRouteConfigFn<TIsRoot extends boolean = false, TParentId extends string = string, TParentPath extends string = string,
|
|
479
|
+
declare type CreateRouteConfigFn<TIsRoot extends boolean = false, TParentId extends string = string, TParentPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TParentSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}> = <TRouteId extends string, TPath extends string, TRouteLoaderData extends AnyLoaderData, TActionPayload, TActionResponse, TSearchSchema extends AnySearchSchema = AnySearchSchema, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams> = AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams>, TKnownChildren extends RouteConfig[] = RouteConfig[], TResolvedId extends string = string extends TRouteId ? string extends TPath ? string : TPath : TRouteId>(options?: TIsRoot extends true ? Omit<RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, Expand<TParentLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, 'path'> & {
|
|
476
480
|
path?: never;
|
|
477
|
-
} : RouteOptions<TRouteId, TPath, TRouteLoaderData, Expand<
|
|
481
|
+
} : RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, Expand<TParentLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, children?: TKnownChildren, isRoot?: boolean, parentId?: string, parentPath?: string) => RouteConfig<RoutePrefix<TParentId, TResolvedId>, TResolvedId, TPath, string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>, TParentRouteLoaderData, TRouteLoaderData, Expand<TParentLoaderData & DeepAwaited<NoInfer<TRouteLoaderData>>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>, TKnownChildren>;
|
|
478
482
|
declare type RoutePath<T extends string> = T extends RootRouteId ? '/' : TrimPathRight<`${T}`>;
|
|
479
483
|
declare type RoutePrefix<TPrefix extends string, TId extends string> = string extends TId ? RootRouteId : TId extends string ? `${TPrefix}/${TId}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TId>}`>}` : never;
|
|
480
|
-
interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
484
|
+
interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
481
485
|
}
|
|
482
|
-
interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
|
|
486
|
+
interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
|
|
483
487
|
}
|
|
484
488
|
declare type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
|
|
485
489
|
declare type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
|
|
@@ -521,6 +525,7 @@ declare type NavigateOptionsAbsolute<TAllRouteInfo extends AnyAllRouteInfo = Def
|
|
|
521
525
|
declare type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.', TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
|
|
522
526
|
to?: ToPathOption<TAllRouteInfo, TFrom, TTo>;
|
|
523
527
|
hash?: Updater<string>;
|
|
528
|
+
state?: LocationState;
|
|
524
529
|
from?: TFrom;
|
|
525
530
|
} & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
|
|
526
531
|
declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
|
|
@@ -1524,7 +1524,10 @@
|
|
|
1524
1524
|
var _ref, _ref2, _opts$maxAge;
|
|
1525
1525
|
|
|
1526
1526
|
if (routeMatch.options.loader) {
|
|
1527
|
+
var _routeMatch$parentMat3;
|
|
1528
|
+
|
|
1527
1529
|
const data = await routeMatch.options.loader({
|
|
1530
|
+
parentLoaderPromise: (_routeMatch$parentMat3 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat3.__.dataPromise,
|
|
1528
1531
|
params: routeMatch.params,
|
|
1529
1532
|
search: routeMatch.routeSearch,
|
|
1530
1533
|
signal: routeMatch.__.abortController.signal
|
|
@@ -1541,6 +1544,7 @@
|
|
|
1541
1544
|
routeMatch.status = 'success';
|
|
1542
1545
|
routeMatch.updatedAt = Date.now();
|
|
1543
1546
|
routeMatch.invalidAt = routeMatch.updatedAt + ((_ref = (_ref2 = (_opts$maxAge = opts == null ? void 0 : opts.maxAge) != null ? _opts$maxAge : routeMatch.options.loaderMaxAge) != null ? _ref2 : router.options.defaultLoaderMaxAge) != null ? _ref : 0);
|
|
1547
|
+
return routeMatch.routeLoaderData;
|
|
1544
1548
|
} catch (err) {
|
|
1545
1549
|
if (id !== routeMatch.__.latestId) {
|
|
1546
1550
|
return routeMatch.__.loadPromise;
|
|
@@ -1553,11 +1557,12 @@
|
|
|
1553
1557
|
routeMatch.error = err;
|
|
1554
1558
|
routeMatch.status = 'error';
|
|
1555
1559
|
routeMatch.updatedAt = Date.now();
|
|
1560
|
+
throw err;
|
|
1556
1561
|
}
|
|
1557
1562
|
});
|
|
1558
1563
|
|
|
1559
1564
|
try {
|
|
1560
|
-
await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise]);
|
|
1565
|
+
await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise.catch(() => {})]);
|
|
1561
1566
|
|
|
1562
1567
|
if (id !== routeMatch.__.latestId) {
|
|
1563
1568
|
return routeMatch.__.loadPromise;
|
|
@@ -2039,6 +2044,7 @@
|
|
|
2039
2044
|
const interpolatedPath = interpolatePath(foundRoute.routePath, params);
|
|
2040
2045
|
const matchId = interpolatePath(foundRoute.routeId, params, true);
|
|
2041
2046
|
const match = existingMatches.find(d => d.matchId === matchId) || ((_router$matchCache$ma = router.matchCache[matchId]) == null ? void 0 : _router$matchCache$ma.match) || createRouteMatch(router, foundRoute, {
|
|
2047
|
+
parentMatch,
|
|
2042
2048
|
matchId,
|
|
2043
2049
|
params,
|
|
2044
2050
|
pathname: joinPaths([pathname, interpolatedPath])
|
|
@@ -2399,9 +2405,9 @@
|
|
|
2399
2405
|
pathname: next.pathname,
|
|
2400
2406
|
hash: next.hash,
|
|
2401
2407
|
search: next.searchStr
|
|
2402
|
-
}, {
|
|
2408
|
+
}, _extends({
|
|
2403
2409
|
id
|
|
2404
|
-
});
|
|
2410
|
+
}, next.state));
|
|
2405
2411
|
} else {
|
|
2406
2412
|
history.push({
|
|
2407
2413
|
pathname: next.pathname,
|