@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/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -1971,12 +1971,38 @@ export class Router<
|
|
|
1971
1971
|
const existingMatch = this.getMatch(matchId)!
|
|
1972
1972
|
const parentMatchId = matches[index - 1]?.id
|
|
1973
1973
|
|
|
1974
|
+
const route = this.looseRoutesById[routeId]!
|
|
1975
|
+
|
|
1976
|
+
const pendingMs =
|
|
1977
|
+
route.options.pendingMs ?? this.options.defaultPendingMs
|
|
1978
|
+
|
|
1979
|
+
const shouldPending = !!(
|
|
1980
|
+
onReady &&
|
|
1981
|
+
!this.isServer &&
|
|
1982
|
+
!preload &&
|
|
1983
|
+
(route.options.loader || route.options.beforeLoad) &&
|
|
1984
|
+
typeof pendingMs === 'number' &&
|
|
1985
|
+
pendingMs !== Infinity &&
|
|
1986
|
+
(route.options.pendingComponent ??
|
|
1987
|
+
this.options.defaultPendingComponent)
|
|
1988
|
+
)
|
|
1989
|
+
|
|
1974
1990
|
if (
|
|
1975
1991
|
// If we are in the middle of a load, either of these will be present
|
|
1976
1992
|
// (not to be confused with `loadPromise`, which is always defined)
|
|
1977
1993
|
existingMatch.beforeLoadPromise ||
|
|
1978
1994
|
existingMatch.loaderPromise
|
|
1979
1995
|
) {
|
|
1996
|
+
if (shouldPending) {
|
|
1997
|
+
setTimeout(() => {
|
|
1998
|
+
try {
|
|
1999
|
+
// Update the match and prematurely resolve the loadMatches promise so that
|
|
2000
|
+
// the pending component can start rendering
|
|
2001
|
+
triggerOnReady()
|
|
2002
|
+
} catch {}
|
|
2003
|
+
}, pendingMs)
|
|
2004
|
+
}
|
|
2005
|
+
|
|
1980
2006
|
// Wait for the beforeLoad to resolve before we continue
|
|
1981
2007
|
await existingMatch.beforeLoadPromise
|
|
1982
2008
|
} else {
|
|
@@ -1990,23 +2016,8 @@ export class Router<
|
|
|
1990
2016
|
beforeLoadPromise: createControlledPromise<void>(),
|
|
1991
2017
|
}))
|
|
1992
2018
|
|
|
1993
|
-
const route = this.looseRoutesById[routeId]!
|
|
1994
2019
|
const abortController = new AbortController()
|
|
1995
2020
|
|
|
1996
|
-
const pendingMs =
|
|
1997
|
-
route.options.pendingMs ?? this.options.defaultPendingMs
|
|
1998
|
-
|
|
1999
|
-
const shouldPending = !!(
|
|
2000
|
-
onReady &&
|
|
2001
|
-
!this.isServer &&
|
|
2002
|
-
!preload &&
|
|
2003
|
-
(route.options.loader || route.options.beforeLoad) &&
|
|
2004
|
-
typeof pendingMs === 'number' &&
|
|
2005
|
-
pendingMs !== Infinity &&
|
|
2006
|
-
(route.options.pendingComponent ??
|
|
2007
|
-
this.options.defaultPendingComponent)
|
|
2008
|
-
)
|
|
2009
|
-
|
|
2010
2021
|
let pendingTimeout: ReturnType<typeof setTimeout>
|
|
2011
2022
|
|
|
2012
2023
|
if (shouldPending) {
|