@tanstack/react-router 1.112.9 → 1.112.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.112.9",
3
+ "version": "1.112.11",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/router.ts CHANGED
@@ -2313,14 +2313,19 @@ export class Router<
2313
2313
  if (executeBeforeLoad) {
2314
2314
  // If we are not in the middle of a load OR the previous load failed, start it
2315
2315
  try {
2316
- updateMatch(matchId, (prev) => ({
2317
- ...prev,
2318
- loadPromise: createControlledPromise<void>(() => {
2319
- prev.loadPromise?.resolve()
2320
- }),
2321
- beforeLoadPromise: createControlledPromise<void>(),
2322
- }))
2323
-
2316
+ updateMatch(matchId, (prev) => {
2317
+ // explicitly capture the previous loadPromise
2318
+ const prevLoadPromise = prev.loadPromise
2319
+ return {
2320
+ ...prev,
2321
+ loadPromise: createControlledPromise<void>(
2322
+ function demo() {
2323
+ prevLoadPromise?.resolve()
2324
+ },
2325
+ ),
2326
+ beforeLoadPromise: createControlledPromise<void>(),
2327
+ }
2328
+ })
2324
2329
  const abortController = new AbortController()
2325
2330
 
2326
2331
  let pendingTimeout: ReturnType<typeof setTimeout>