@tanstack/react-router 1.52.4 → 1.52.5
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 -3
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +11 -3
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +26 -15
package/dist/esm/router.js
CHANGED
|
@@ -666,11 +666,22 @@ class Router {
|
|
|
666
666
|
for (const [index, { id: matchId, routeId }] of matches.entries()) {
|
|
667
667
|
const existingMatch = this.getMatch(matchId);
|
|
668
668
|
const parentMatchId = (_a = matches[index - 1]) == null ? void 0 : _a.id;
|
|
669
|
+
const route = this.looseRoutesById[routeId];
|
|
670
|
+
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
671
|
+
const shouldPending = !!(onReady && !this.isServer && !preload && (route.options.loader || route.options.beforeLoad) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? this.options.defaultPendingComponent));
|
|
669
672
|
if (
|
|
670
673
|
// If we are in the middle of a load, either of these will be present
|
|
671
674
|
// (not to be confused with `loadPromise`, which is always defined)
|
|
672
675
|
existingMatch.beforeLoadPromise || existingMatch.loaderPromise
|
|
673
676
|
) {
|
|
677
|
+
if (shouldPending) {
|
|
678
|
+
setTimeout(() => {
|
|
679
|
+
try {
|
|
680
|
+
triggerOnReady();
|
|
681
|
+
} catch {
|
|
682
|
+
}
|
|
683
|
+
}, pendingMs);
|
|
684
|
+
}
|
|
674
685
|
await existingMatch.beforeLoadPromise;
|
|
675
686
|
} else {
|
|
676
687
|
try {
|
|
@@ -682,10 +693,7 @@ class Router {
|
|
|
682
693
|
}),
|
|
683
694
|
beforeLoadPromise: createControlledPromise()
|
|
684
695
|
}));
|
|
685
|
-
const route = this.looseRoutesById[routeId];
|
|
686
696
|
const abortController = new AbortController();
|
|
687
|
-
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
688
|
-
const shouldPending = !!(onReady && !this.isServer && !preload && (route.options.loader || route.options.beforeLoad) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? this.options.defaultPendingComponent));
|
|
689
697
|
let pendingTimeout;
|
|
690
698
|
if (shouldPending) {
|
|
691
699
|
pendingTimeout = setTimeout(() => {
|