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