@tanstack/router-core 1.123.0 → 1.123.2
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 +15 -9
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +15 -9
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +26 -16
package/dist/cjs/router.cjs
CHANGED
|
@@ -505,11 +505,9 @@ class RouterCore {
|
|
|
505
505
|
location: this.latestLocation,
|
|
506
506
|
pendingMatches,
|
|
507
507
|
// If a cached moved to pendingMatches, remove it from cachedMatches
|
|
508
|
-
cachedMatches: s.cachedMatches.filter(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return cachedMatch.status === "success" && (cachedMatch.isFetching || cachedMatch.loaderData !== void 0);
|
|
512
|
-
})
|
|
508
|
+
cachedMatches: s.cachedMatches.filter(
|
|
509
|
+
(d) => !pendingMatches.find((e) => e.id === d.id)
|
|
510
|
+
)
|
|
513
511
|
}));
|
|
514
512
|
};
|
|
515
513
|
this.load = async (opts) => {
|
|
@@ -800,7 +798,12 @@ class RouterCore {
|
|
|
800
798
|
}, pendingMs);
|
|
801
799
|
}
|
|
802
800
|
await existingMatch.beforeLoadPromise;
|
|
803
|
-
|
|
801
|
+
const match = this.getMatch(matchId);
|
|
802
|
+
if (match.status === "error") {
|
|
803
|
+
executeBeforeLoad = true;
|
|
804
|
+
} else if (match.preload && (match.status === "redirected" || match.status === "notFound")) {
|
|
805
|
+
handleRedirectAndNotFound(match, match.error);
|
|
806
|
+
}
|
|
804
807
|
}
|
|
805
808
|
if (executeBeforeLoad) {
|
|
806
809
|
try {
|
|
@@ -892,11 +895,14 @@ class RouterCore {
|
|
|
892
895
|
validResolvedMatches.forEach(({ id: matchId, routeId }, index) => {
|
|
893
896
|
matchPromises.push(
|
|
894
897
|
(async () => {
|
|
895
|
-
const { loaderPromise: prevLoaderPromise } = this.getMatch(matchId);
|
|
896
898
|
let loaderShouldRunAsync = false;
|
|
897
899
|
let loaderIsRunningAsync = false;
|
|
898
|
-
|
|
899
|
-
|
|
900
|
+
const prevMatch = this.getMatch(matchId);
|
|
901
|
+
if (prevMatch.loaderPromise) {
|
|
902
|
+
if (prevMatch.status === "success" && !sync && !prevMatch.preload) {
|
|
903
|
+
return this.getMatch(matchId);
|
|
904
|
+
}
|
|
905
|
+
await prevMatch.loaderPromise;
|
|
900
906
|
const match = this.getMatch(matchId);
|
|
901
907
|
if (match.error) {
|
|
902
908
|
handleRedirectAndNotFound(match, match.error);
|