@tanstack/router-core 1.131.12 → 1.131.13
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 +31 -41
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -3
- package/dist/esm/router.d.ts +1 -3
- package/dist/esm/router.js +31 -41
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +43 -53
package/dist/cjs/router.d.cts
CHANGED
|
@@ -549,9 +549,7 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
|
|
|
549
549
|
manifest: Manifest | undefined;
|
|
550
550
|
};
|
|
551
551
|
serverSsr?: ServerSsr;
|
|
552
|
-
_handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError,
|
|
553
|
-
updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
|
554
|
-
}) => void;
|
|
552
|
+
_handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError, updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void) => void;
|
|
555
553
|
hasNotFoundMatch: () => boolean;
|
|
556
554
|
}
|
|
557
555
|
export declare class SearchParamError extends Error {
|
package/dist/esm/router.d.ts
CHANGED
|
@@ -549,9 +549,7 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
|
|
|
549
549
|
manifest: Manifest | undefined;
|
|
550
550
|
};
|
|
551
551
|
serverSsr?: ServerSsr;
|
|
552
|
-
_handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError,
|
|
553
|
-
updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
|
554
|
-
}) => void;
|
|
552
|
+
_handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError, updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void) => void;
|
|
555
553
|
hasNotFoundMatch: () => boolean;
|
|
556
554
|
}
|
|
557
555
|
export declare class SearchParamError extends Error {
|
package/dist/esm/router.js
CHANGED
|
@@ -727,42 +727,36 @@ class RouterCore {
|
|
|
727
727
|
}
|
|
728
728
|
const handleRedirectAndNotFound = (match, err) => {
|
|
729
729
|
var _a, _b, _c;
|
|
730
|
-
if (isRedirect(err)
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}));
|
|
749
|
-
if (!err.routeId) {
|
|
750
|
-
err.routeId = match.routeId;
|
|
751
|
-
}
|
|
752
|
-
(_c = match._nonReactive.loadPromise) == null ? void 0 : _c.resolve();
|
|
753
|
-
}
|
|
754
|
-
if (isRedirect(err)) {
|
|
755
|
-
rendered = true;
|
|
756
|
-
err.options._fromLocation = location;
|
|
757
|
-
err.redirectHandled = true;
|
|
758
|
-
err = this.resolveRedirect(err);
|
|
759
|
-
throw err;
|
|
760
|
-
} else if (isNotFound(err)) {
|
|
761
|
-
this._handleNotFound(matches, err, {
|
|
762
|
-
updateMatch
|
|
763
|
-
});
|
|
764
|
-
throw err;
|
|
730
|
+
if (!isRedirect(err) && !isNotFound(err)) return;
|
|
731
|
+
if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) {
|
|
732
|
+
throw err;
|
|
733
|
+
}
|
|
734
|
+
if (match) {
|
|
735
|
+
(_a = match._nonReactive.beforeLoadPromise) == null ? void 0 : _a.resolve();
|
|
736
|
+
(_b = match._nonReactive.loaderPromise) == null ? void 0 : _b.resolve();
|
|
737
|
+
match._nonReactive.beforeLoadPromise = void 0;
|
|
738
|
+
match._nonReactive.loaderPromise = void 0;
|
|
739
|
+
const status = isRedirect(err) ? "redirected" : "notFound";
|
|
740
|
+
updateMatch(match.id, (prev) => ({
|
|
741
|
+
...prev,
|
|
742
|
+
status,
|
|
743
|
+
isFetching: false,
|
|
744
|
+
error: err
|
|
745
|
+
}));
|
|
746
|
+
if (isNotFound(err) && !err.routeId) {
|
|
747
|
+
err.routeId = match.routeId;
|
|
765
748
|
}
|
|
749
|
+
(_c = match._nonReactive.loadPromise) == null ? void 0 : _c.resolve();
|
|
750
|
+
}
|
|
751
|
+
if (isRedirect(err)) {
|
|
752
|
+
rendered = true;
|
|
753
|
+
err.options._fromLocation = location;
|
|
754
|
+
err.redirectHandled = true;
|
|
755
|
+
err = this.resolveRedirect(err);
|
|
756
|
+
throw err;
|
|
757
|
+
} else {
|
|
758
|
+
this._handleNotFound(matches, err, updateMatch);
|
|
759
|
+
throw err;
|
|
766
760
|
}
|
|
767
761
|
};
|
|
768
762
|
const shouldSkipLoader = (matchId) => {
|
|
@@ -1409,9 +1403,7 @@ class RouterCore {
|
|
|
1409
1403
|
}
|
|
1410
1404
|
return match;
|
|
1411
1405
|
};
|
|
1412
|
-
this._handleNotFound = (matches, err, {
|
|
1413
|
-
updateMatch = this.updateMatch
|
|
1414
|
-
} = {}) => {
|
|
1406
|
+
this._handleNotFound = (matches, err, updateMatch = this.updateMatch) => {
|
|
1415
1407
|
var _a;
|
|
1416
1408
|
const routeCursor = this.routesById[err.routeId ?? ""] ?? this.routeTree;
|
|
1417
1409
|
const matchesByRouteId = {};
|
|
@@ -1438,9 +1430,7 @@ class RouterCore {
|
|
|
1438
1430
|
}));
|
|
1439
1431
|
if (err.routerCode === "BEFORE_LOAD" && routeCursor.parentRoute) {
|
|
1440
1432
|
err.routeId = routeCursor.parentRoute.id;
|
|
1441
|
-
this._handleNotFound(matches, err,
|
|
1442
|
-
updateMatch
|
|
1443
|
-
});
|
|
1433
|
+
this._handleNotFound(matches, err, updateMatch);
|
|
1444
1434
|
}
|
|
1445
1435
|
};
|
|
1446
1436
|
this.hasNotFoundMatch = () => {
|