@tanstack/react-router 1.52.3 → 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.
@@ -431,10 +431,6 @@ class Router {
431
431
  };
432
432
  this.load = async () => {
433
433
  this.latestLocation = this.parseLocation(this.latestLocation);
434
- this.__store.setState((s) => ({
435
- ...s,
436
- loadedAt: Date.now()
437
- }));
438
434
  let redirect;
439
435
  let notFound;
440
436
  let loadPromise;
@@ -500,6 +496,7 @@ class Router {
500
496
  return {
501
497
  ...s,
502
498
  isLoading: false,
499
+ loadedAt: Date.now(),
503
500
  matches: newMatches,
504
501
  pendingMatches: void 0,
505
502
  cachedMatches: [
@@ -669,11 +666,22 @@ class Router {
669
666
  for (const [index, { id: matchId, routeId }] of matches.entries()) {
670
667
  const existingMatch = this.getMatch(matchId);
671
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));
672
672
  if (
673
673
  // If we are in the middle of a load, either of these will be present
674
674
  // (not to be confused with `loadPromise`, which is always defined)
675
675
  existingMatch.beforeLoadPromise || existingMatch.loaderPromise
676
676
  ) {
677
+ if (shouldPending) {
678
+ setTimeout(() => {
679
+ try {
680
+ triggerOnReady();
681
+ } catch {
682
+ }
683
+ }, pendingMs);
684
+ }
677
685
  await existingMatch.beforeLoadPromise;
678
686
  } else {
679
687
  try {
@@ -685,10 +693,7 @@ class Router {
685
693
  }),
686
694
  beforeLoadPromise: createControlledPromise()
687
695
  }));
688
- const route = this.looseRoutesById[routeId];
689
696
  const abortController = new AbortController();
690
- const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
691
- const shouldPending = !!(onReady && !this.isServer && !preload && (route.options.loader || route.options.beforeLoad) && typeof pendingMs === "number" && pendingMs !== Infinity && (route.options.pendingComponent ?? this.options.defaultPendingComponent));
692
697
  let pendingTimeout;
693
698
  if (shouldPending) {
694
699
  pendingTimeout = setTimeout(() => {