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