@tanstack/react-router 1.4.5 → 1.4.6

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.
@@ -28,6 +28,7 @@ export interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRouteId ext
28
28
  loaderDeps: RouteById<TRouteTree, TRouteId>['types']['loaderDeps'];
29
29
  preload: boolean;
30
30
  invalid: boolean;
31
+ pendingPromise?: Promise<void>;
31
32
  }
32
33
  export type AnyRouteMatch = RouteMatch<any, any>;
33
34
  export declare function Matches(): React.JSX.Element;
@@ -2712,6 +2712,8 @@
2712
2712
  handleErrorAndRedirect(match.searchError, 'VALIDATE_SEARCH');
2713
2713
  }
2714
2714
  const parentContext = parentMatch?.context ?? this.options.context ?? {};
2715
+ const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
2716
+ const pendingPromise = new Promise(r => setTimeout(r, pendingMs));
2715
2717
  const beforeLoadContext = (await route.options.beforeLoad?.({
2716
2718
  search: match.search,
2717
2719
  abortController,
@@ -2738,7 +2740,8 @@
2738
2740
  ...match,
2739
2741
  routeContext: replaceEqualDeep(match.routeContext, beforeLoadContext),
2740
2742
  context: replaceEqualDeep(match.context, context),
2741
- abortController
2743
+ abortController,
2744
+ pendingPromise
2742
2745
  };
2743
2746
  } catch (err) {
2744
2747
  handleErrorAndRedirect(err, 'BEFORE_LOAD');
@@ -2879,7 +2882,7 @@
2879
2882
  // If we need to potentially show the pending component,
2880
2883
  // start a timer to show it after the pendingMs
2881
2884
  if (shouldPending) {
2882
- new Promise(r => setTimeout(r, pendingMs)).then(async () => {
2885
+ match.pendingPromise?.then(async () => {
2883
2886
  if (latestPromise = checkLatest()) return latestPromise;
2884
2887
  didShowPending = true;
2885
2888
  matches[index] = match = {