@tanstack/router-core 1.115.3 → 1.117.1
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/router.cjs +11 -6
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +7 -1
- package/dist/esm/router.d.ts +7 -1
- package/dist/esm/router.js +11 -6
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +30 -11
package/dist/cjs/router.d.cts
CHANGED
|
@@ -434,7 +434,13 @@ export interface ServerSrr {
|
|
|
434
434
|
export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
|
|
435
435
|
export type AnyRouter = RouterCore<any, any, any, any, any>;
|
|
436
436
|
export interface ViewTransitionOptions {
|
|
437
|
-
types: Array<string
|
|
437
|
+
types: Array<string> | ((locationChangeInfo: {
|
|
438
|
+
fromLocation?: ParsedLocation;
|
|
439
|
+
toLocation: ParsedLocation;
|
|
440
|
+
pathChanged: boolean;
|
|
441
|
+
hrefChanged: boolean;
|
|
442
|
+
hashChanged: boolean;
|
|
443
|
+
}) => Array<string>);
|
|
438
444
|
}
|
|
439
445
|
export declare function defaultSerializeError(err: unknown): {
|
|
440
446
|
name: string;
|
package/dist/esm/router.d.ts
CHANGED
|
@@ -434,7 +434,13 @@ export interface ServerSrr {
|
|
|
434
434
|
export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
|
|
435
435
|
export type AnyRouter = RouterCore<any, any, any, any, any>;
|
|
436
436
|
export interface ViewTransitionOptions {
|
|
437
|
-
types: Array<string
|
|
437
|
+
types: Array<string> | ((locationChangeInfo: {
|
|
438
|
+
fromLocation?: ParsedLocation;
|
|
439
|
+
toLocation: ParsedLocation;
|
|
440
|
+
pathChanged: boolean;
|
|
441
|
+
hrefChanged: boolean;
|
|
442
|
+
hashChanged: boolean;
|
|
443
|
+
}) => Array<string>);
|
|
438
444
|
}
|
|
439
445
|
export declare function defaultSerializeError(err: unknown): {
|
|
440
446
|
name: string;
|
package/dist/esm/router.js
CHANGED
|
@@ -772,9 +772,17 @@ class RouterCore {
|
|
|
772
772
|
if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
|
|
773
773
|
let startViewTransitionParams;
|
|
774
774
|
if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
|
|
775
|
+
const next = this.latestLocation;
|
|
776
|
+
const prevLocation = this.state.resolvedLocation;
|
|
777
|
+
const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(
|
|
778
|
+
getLocationChangeInfo({
|
|
779
|
+
resolvedLocation: prevLocation,
|
|
780
|
+
location: next
|
|
781
|
+
})
|
|
782
|
+
) : shouldViewTransition.types;
|
|
775
783
|
startViewTransitionParams = {
|
|
776
784
|
update: fn,
|
|
777
|
-
types:
|
|
785
|
+
types: resolvedViewTransitionTypes
|
|
778
786
|
};
|
|
779
787
|
} else {
|
|
780
788
|
startViewTransitionParams = fn;
|
|
@@ -830,9 +838,6 @@ class RouterCore {
|
|
|
830
838
|
const resolvePreload = (matchId) => {
|
|
831
839
|
return !!(allPreload && !this.state.matches.find((d) => d.id === matchId));
|
|
832
840
|
};
|
|
833
|
-
if (!this.isServer && !this.state.matches.length) {
|
|
834
|
-
triggerOnReady();
|
|
835
|
-
}
|
|
836
841
|
const handleRedirectAndNotFound = (match, err) => {
|
|
837
842
|
var _a, _b, _c, _d;
|
|
838
843
|
if (isResolvedRedirect(err)) {
|
|
@@ -913,7 +918,7 @@ class RouterCore {
|
|
|
913
918
|
const parentMatchId = (_a = matches[index - 1]) == null ? void 0 : _a.id;
|
|
914
919
|
const route = this.looseRoutesById[routeId];
|
|
915
920
|
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
916
|
-
const shouldPending = !!(onReady && !this.isServer && !resolvePreload(matchId) && (route.options.loader || route.options.beforeLoad) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? ((_b = this.options) == null ? void 0 : _b.defaultPendingComponent)));
|
|
921
|
+
const shouldPending = !!(onReady && !this.isServer && !resolvePreload(matchId) && (route.options.loader || route.options.beforeLoad || routeNeedsPreload(route)) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? ((_b = this.options) == null ? void 0 : _b.defaultPendingComponent)));
|
|
917
922
|
let executeBeforeLoad = true;
|
|
918
923
|
if (
|
|
919
924
|
// If we are in the middle of a load, either of these will be present
|
|
@@ -1101,6 +1106,7 @@ class RouterCore {
|
|
|
1101
1106
|
const headers = (_h = (_g = route.options).headers) == null ? void 0 : _h.call(_g, {
|
|
1102
1107
|
loaderData
|
|
1103
1108
|
});
|
|
1109
|
+
await route._componentsPromise;
|
|
1104
1110
|
updateMatch(matchId, (prev) => ({
|
|
1105
1111
|
...prev,
|
|
1106
1112
|
error: void 0,
|
|
@@ -1138,7 +1144,6 @@ class RouterCore {
|
|
|
1138
1144
|
router: this,
|
|
1139
1145
|
match: this.getMatch(matchId)
|
|
1140
1146
|
});
|
|
1141
|
-
await route._componentsPromise;
|
|
1142
1147
|
} catch (err) {
|
|
1143
1148
|
updateMatch(matchId, (prev) => ({
|
|
1144
1149
|
...prev,
|