@tanstack/router-core 0.0.1-beta.167 → 0.0.1-beta.169
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/fileRoute.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +18 -10
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/scroll-restoration.js +3 -0
- package/build/cjs/scroll-restoration.js.map +1 -1
- package/build/esm/index.js +21 -10
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +132 -132
- package/build/types/index.d.ts +29 -22
- package/build/umd/index.development.js +21 -10
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/fileRoute.ts +0 -1
- package/src/link.ts +1 -0
- package/src/route.ts +88 -39
- package/src/router.ts +34 -34
- package/src/scroll-restoration.ts +4 -0
package/build/types/index.d.ts
CHANGED
|
@@ -188,9 +188,9 @@ interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<
|
|
|
188
188
|
parseSearch?: SearchParser;
|
|
189
189
|
defaultPreload?: false | 'intent';
|
|
190
190
|
defaultPreloadDelay?: number;
|
|
191
|
-
defaultComponent?: RegisteredRouteComponent<
|
|
192
|
-
defaultErrorComponent?:
|
|
193
|
-
defaultPendingComponent?:
|
|
191
|
+
defaultComponent?: RegisteredRouteComponent<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>;
|
|
192
|
+
defaultErrorComponent?: RegisteredErrorRouteComponent<AnySearchSchema, AnyPathParams, AnyContext, AnyContext>;
|
|
193
|
+
defaultPendingComponent?: RegisteredPendingRouteComponent<AnySearchSchema, AnyPathParams, AnyContext, AnyContext>;
|
|
194
194
|
defaultMaxAge?: number;
|
|
195
195
|
defaultGcMaxAge?: number;
|
|
196
196
|
defaultPreloadMaxAge?: number;
|
|
@@ -292,6 +292,7 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends
|
|
|
292
292
|
__store: Store<RouterState<TRouteTree>>;
|
|
293
293
|
state: RouterState<TRouteTree>;
|
|
294
294
|
dehydratedData?: TDehydrated;
|
|
295
|
+
resetNextScroll: boolean;
|
|
295
296
|
constructor(options: RouterConstructorOptions<TRouteTree, TDehydrated>);
|
|
296
297
|
subscribers: Set<RouterListener<RouterEvent>>;
|
|
297
298
|
subscribe: <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
|
|
@@ -325,9 +326,9 @@ declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends
|
|
|
325
326
|
}) => Promise<void>;
|
|
326
327
|
reload: () => Promise<void>;
|
|
327
328
|
resolvePath: (from: string, path: string) => string;
|
|
328
|
-
navigate: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRouteTree, TFrom, TTo>) => Promise<void>;
|
|
329
|
+
navigate: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, hash, replace, params, resetScroll, }: NavigateOptions<TRouteTree, TFrom, TTo>) => Promise<void>;
|
|
329
330
|
matchRoute: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRouteTree, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>["types"]["allParams"];
|
|
330
|
-
buildLink: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, state, }: LinkOptions<TRouteTree, TFrom, TTo>) => LinkInfo;
|
|
331
|
+
buildLink: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, state, resetScroll, }: LinkOptions<TRouteTree, TFrom, TTo>) => LinkInfo;
|
|
331
332
|
dehydrate: () => DehydratedRouter;
|
|
332
333
|
hydrate: (__do_not_use_server_ctx?: HydrationCtx) => Promise<void>;
|
|
333
334
|
injectedHtml: (string | (() => Promise<string> | string))[];
|
|
@@ -370,9 +371,11 @@ interface RouteMeta {
|
|
|
370
371
|
}
|
|
371
372
|
interface RouteContext {
|
|
372
373
|
}
|
|
373
|
-
interface RegisterRouteComponent<
|
|
374
|
+
interface RegisterRouteComponent<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
374
375
|
}
|
|
375
|
-
interface
|
|
376
|
+
interface RegisterErrorRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
377
|
+
}
|
|
378
|
+
interface RegisterPendingRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
376
379
|
}
|
|
377
380
|
interface RegisterRouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
378
381
|
}
|
|
@@ -380,21 +383,24 @@ interface RegisterErrorRouteProps<TFullSearchSchema extends AnySearchSchema = An
|
|
|
380
383
|
}
|
|
381
384
|
interface RegisterPendingRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
382
385
|
}
|
|
383
|
-
type RegisteredRouteComponent<
|
|
386
|
+
type RegisteredRouteComponent<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterRouteComponent<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
384
387
|
RouteComponent: infer T;
|
|
385
|
-
} ? T : (
|
|
386
|
-
type
|
|
387
|
-
|
|
388
|
-
} ? T : (
|
|
388
|
+
} ? T : () => unknown;
|
|
389
|
+
type RegisteredErrorRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterErrorRouteComponent<TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
390
|
+
ErrorRouteComponent: infer T;
|
|
391
|
+
} ? T : () => unknown;
|
|
392
|
+
type RegisteredPendingRouteComponent<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterPendingRouteComponent<TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
393
|
+
PendingRouteComponent: infer T;
|
|
394
|
+
} ? T : () => unknown;
|
|
389
395
|
type RegisteredRouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterRouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
390
396
|
RouteProps: infer T;
|
|
391
|
-
} ? T :
|
|
397
|
+
} ? T : {};
|
|
392
398
|
type RegisteredErrorRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
393
399
|
ErrorRouteProps: infer T;
|
|
394
|
-
} ? T :
|
|
400
|
+
} ? T : {};
|
|
395
401
|
type RegisteredPendingRouteProps<TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TRouteContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = RegisterRouteProps<TFullSearchSchema, TAllParams, TRouteContext, TAllContext> extends {
|
|
396
402
|
PendingRouteProps: infer T;
|
|
397
|
-
} ? T :
|
|
403
|
+
} ? T : {};
|
|
398
404
|
type PreloadableObj = {
|
|
399
405
|
preload?: () => Promise<void>;
|
|
400
406
|
};
|
|
@@ -447,9 +453,9 @@ type UpdatableRouteOptions<TLoader, TSearchSchema extends AnySearchSchema, TFull
|
|
|
447
453
|
key?: null | false | GetKeyFn<TFullSearchSchema, TAllParams>;
|
|
448
454
|
caseSensitive?: boolean;
|
|
449
455
|
wrapInSuspense?: boolean;
|
|
450
|
-
component?: RegisteredRouteComponent<
|
|
451
|
-
errorComponent?:
|
|
452
|
-
pendingComponent?:
|
|
456
|
+
component?: RegisteredRouteComponent<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TAllContext>;
|
|
457
|
+
errorComponent?: RegisteredErrorRouteComponent<TFullSearchSchema, TAllParams, TRouteContext, TAllContext>;
|
|
458
|
+
pendingComponent?: RegisteredPendingRouteComponent<TFullSearchSchema, TAllParams, TRouteContext, TAllContext>;
|
|
453
459
|
preSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
454
460
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
455
461
|
preloadMaxAge?: number;
|
|
@@ -616,9 +622,9 @@ declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute e
|
|
|
616
622
|
key?: false | GetKeyFn<TFullSearchSchema, TAllParams> | null | undefined;
|
|
617
623
|
caseSensitive?: boolean | undefined;
|
|
618
624
|
wrapInSuspense?: boolean | undefined;
|
|
619
|
-
component?: ((
|
|
620
|
-
errorComponent?: ((
|
|
621
|
-
pendingComponent?: ((
|
|
625
|
+
component?: (() => unknown) | undefined;
|
|
626
|
+
errorComponent?: (() => unknown) | undefined;
|
|
627
|
+
pendingComponent?: (() => unknown) | undefined;
|
|
622
628
|
preSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
623
629
|
postSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
624
630
|
preloadMaxAge?: number | undefined;
|
|
@@ -676,6 +682,7 @@ type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, T
|
|
|
676
682
|
} ? never : './' : never) | (TFrom extends `/` ? never : '../') | AllPaths;
|
|
677
683
|
type NavigateOptions<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = ''> = ToOptions<TRouteTree, TFrom, TTo> & {
|
|
678
684
|
replace?: boolean;
|
|
685
|
+
resetScroll?: boolean;
|
|
679
686
|
};
|
|
680
687
|
type ToOptions<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string = '', TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
|
|
681
688
|
to?: ToPathOption<TRouteTree, TFrom, TTo>;
|
|
@@ -775,4 +782,4 @@ type DeferredPromise<T> = Promise<T> & {
|
|
|
775
782
|
declare function defer<T>(_promise: Promise<T>): DeferredPromise<T>;
|
|
776
783
|
declare function isDehydratedDeferred(obj: any): boolean;
|
|
777
784
|
|
|
778
|
-
export { ActiveOptions, AllParams, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouter, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, CleanPath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DeferredPromise, DeferredPromiseState, DefinedPathParamWarning, DehydratedRouteMatch, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutePath, FileRoutesByPath, FromLocation, FullSearchSchema, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterErrorRouteProps, RegisterPendingRouteProps, RegisterRouteComponent,
|
|
785
|
+
export { ActiveOptions, AllParams, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouter, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, CleanPath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DeferredPromise, DeferredPromiseState, DefinedPathParamWarning, DehydratedRouteMatch, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutePath, FileRoutesByPath, FromLocation, FullSearchSchema, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterErrorRouteComponent, RegisterErrorRouteProps, RegisterPendingRouteComponent, RegisterPendingRouteProps, RegisterRouteComponent, RegisterRouteProps, RegisteredErrorRouteComponent, RegisteredErrorRouteProps, RegisteredPendingRouteComponent, RegisteredPendingRouteProps, RegisteredRouteComponent, RegisteredRouteProps, RegisteredRouter, RelativeToPathAutoComplete, RemoveUnderScores, ResolveFilePath, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteConstraints, RouteContext, RouteIds, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RoutePaths, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterEvent, RouterEvents, RouterHistory, RouterListener, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, ScrollRestorationOptions, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, Trim, TrimLeft, TrimPath, TrimPathLeft, TrimPathRight, TrimRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, defer, encode, functionalUpdate, interpolatePath, isDehydratedDeferred, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, restoreScrollPositions, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, watchScrollPositions };
|
|
@@ -806,6 +806,7 @@
|
|
|
806
806
|
const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
|
|
807
807
|
class Router {
|
|
808
808
|
#unsubHistory;
|
|
809
|
+
resetNextScroll = false;
|
|
809
810
|
constructor(options) {
|
|
810
811
|
this.options = {
|
|
811
812
|
defaultPreloadDelay: 50,
|
|
@@ -1153,8 +1154,8 @@
|
|
|
1153
1154
|
params: routeParams,
|
|
1154
1155
|
pathname: joinPaths([this.basepath, interpolatedPath]),
|
|
1155
1156
|
updatedAt: Date.now(),
|
|
1156
|
-
invalidAt:
|
|
1157
|
-
preloadInvalidAt:
|
|
1157
|
+
invalidAt: Infinity,
|
|
1158
|
+
preloadInvalidAt: Infinity,
|
|
1158
1159
|
routeSearch: {},
|
|
1159
1160
|
search: {},
|
|
1160
1161
|
status: hasLoaders ? 'pending' : 'success',
|
|
@@ -1237,7 +1238,6 @@
|
|
|
1237
1238
|
return matches;
|
|
1238
1239
|
};
|
|
1239
1240
|
loadMatches = async (resolvedMatches, opts) => {
|
|
1240
|
-
this.cleanMatches();
|
|
1241
1241
|
if (!opts?.preload) {
|
|
1242
1242
|
resolvedMatches.forEach(match => {
|
|
1243
1243
|
// Update each match with its latest route data
|
|
@@ -1250,10 +1250,12 @@
|
|
|
1250
1250
|
error: match.error,
|
|
1251
1251
|
paramsError: match.paramsError,
|
|
1252
1252
|
searchError: match.searchError,
|
|
1253
|
-
params: match.params
|
|
1253
|
+
params: match.params,
|
|
1254
|
+
preloadInvalidAt: 0
|
|
1254
1255
|
}));
|
|
1255
1256
|
});
|
|
1256
1257
|
}
|
|
1258
|
+
this.cleanMatches();
|
|
1257
1259
|
let firstBadMatchIndex;
|
|
1258
1260
|
|
|
1259
1261
|
// Check each match middleware to see if the route can be accessed
|
|
@@ -1389,6 +1391,7 @@
|
|
|
1389
1391
|
})());
|
|
1390
1392
|
});
|
|
1391
1393
|
await Promise.all(matchPromises);
|
|
1394
|
+
this.cleanMatches();
|
|
1392
1395
|
};
|
|
1393
1396
|
reload = () => {
|
|
1394
1397
|
return this.navigate({
|
|
@@ -1406,7 +1409,8 @@
|
|
|
1406
1409
|
search,
|
|
1407
1410
|
hash,
|
|
1408
1411
|
replace,
|
|
1409
|
-
params
|
|
1412
|
+
params,
|
|
1413
|
+
resetScroll
|
|
1410
1414
|
}) => {
|
|
1411
1415
|
// If this link simply reloads the current route,
|
|
1412
1416
|
// make sure it has a new key so it will trigger a data refresh
|
|
@@ -1427,7 +1431,8 @@
|
|
|
1427
1431
|
search,
|
|
1428
1432
|
hash,
|
|
1429
1433
|
replace,
|
|
1430
|
-
params
|
|
1434
|
+
params,
|
|
1435
|
+
resetScroll
|
|
1431
1436
|
});
|
|
1432
1437
|
};
|
|
1433
1438
|
matchRoute = (location, opts) => {
|
|
@@ -1467,7 +1472,8 @@
|
|
|
1467
1472
|
preload,
|
|
1468
1473
|
preloadDelay: userPreloadDelay,
|
|
1469
1474
|
disabled,
|
|
1470
|
-
state
|
|
1475
|
+
state,
|
|
1476
|
+
resetScroll
|
|
1471
1477
|
}) => {
|
|
1472
1478
|
// If this link simply reloads the current route,
|
|
1473
1479
|
// make sure it has a new key so it will trigger a data refresh
|
|
@@ -1489,7 +1495,8 @@
|
|
|
1489
1495
|
params,
|
|
1490
1496
|
hash,
|
|
1491
1497
|
replace,
|
|
1492
|
-
state
|
|
1498
|
+
state,
|
|
1499
|
+
resetScroll
|
|
1493
1500
|
};
|
|
1494
1501
|
const next = this.buildNext(nextOpts);
|
|
1495
1502
|
preload = preload ?? this.options.defaultPreload;
|
|
@@ -1807,6 +1814,8 @@
|
|
|
1807
1814
|
id,
|
|
1808
1815
|
...next.state
|
|
1809
1816
|
});
|
|
1817
|
+
this.resetNextScroll = location.resetScroll ?? true;
|
|
1818
|
+
console.log('resetScroll', this.resetNextScroll);
|
|
1810
1819
|
return this.latestLoadPromise;
|
|
1811
1820
|
};
|
|
1812
1821
|
getRouteMatch = id => {
|
|
@@ -1832,7 +1841,7 @@
|
|
|
1832
1841
|
const route = this.getRoute(match.routeId);
|
|
1833
1842
|
const updatedAt = opts?.updatedAt ?? Date.now();
|
|
1834
1843
|
const preloadInvalidAt = updatedAt + (opts?.maxAge ?? route.options.preloadMaxAge ?? this.options.defaultPreloadMaxAge ?? 5000);
|
|
1835
|
-
const invalidAt = updatedAt + (opts?.maxAge ?? route.options.maxAge ?? this.options.defaultMaxAge ??
|
|
1844
|
+
const invalidAt = updatedAt + (opts?.maxAge ?? route.options.maxAge ?? this.options.defaultMaxAge ?? Infinity);
|
|
1836
1845
|
this.setRouteMatch(id, s => ({
|
|
1837
1846
|
...s,
|
|
1838
1847
|
error: undefined,
|
|
@@ -1843,7 +1852,6 @@
|
|
|
1843
1852
|
preloadInvalidAt,
|
|
1844
1853
|
invalidAt
|
|
1845
1854
|
}));
|
|
1846
|
-
if (this.state.matches.find(d => d.id === id)) ;
|
|
1847
1855
|
};
|
|
1848
1856
|
invalidate = async opts => {
|
|
1849
1857
|
if (opts?.matchId) {
|
|
@@ -2026,6 +2034,9 @@
|
|
|
2026
2034
|
}
|
|
2027
2035
|
function restoreScrollPositions(router, opts) {
|
|
2028
2036
|
if (pathDidChange) {
|
|
2037
|
+
if (!router.resetNextScroll) {
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2029
2040
|
const getKey = opts?.getKey || defaultGetKey;
|
|
2030
2041
|
pathDidChange = false;
|
|
2031
2042
|
const restoreKey = getKey(router.state.location);
|