@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.
@@ -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, { updateMatch, }?: {
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 {
@@ -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, { updateMatch, }?: {
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 {
@@ -727,42 +727,36 @@ class RouterCore {
727
727
  }
728
728
  const handleRedirectAndNotFound = (match, err) => {
729
729
  var _a, _b, _c;
730
- if (isRedirect(err) || isNotFound(err)) {
731
- if (isRedirect(err)) {
732
- if (err.redirectHandled) {
733
- if (!err.options.reloadDocument) {
734
- throw err;
735
- }
736
- }
737
- }
738
- if (match) {
739
- (_a = match._nonReactive.beforeLoadPromise) == null ? void 0 : _a.resolve();
740
- (_b = match._nonReactive.loaderPromise) == null ? void 0 : _b.resolve();
741
- match._nonReactive.beforeLoadPromise = void 0;
742
- match._nonReactive.loaderPromise = void 0;
743
- updateMatch(match.id, (prev) => ({
744
- ...prev,
745
- status: isRedirect(err) ? "redirected" : isNotFound(err) ? "notFound" : "error",
746
- isFetching: false,
747
- error: err
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 = () => {