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