@tanstack/router-core 1.130.1 → 1.130.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.
@@ -253,6 +253,10 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
253
253
  * @default false
254
254
  */
255
255
  isShell?: boolean;
256
+ /**
257
+ * @default false
258
+ */
259
+ isPrerendering?: boolean;
256
260
  /**
257
261
  * The default `ssr` a route should use if no `ssr` is provided.
258
262
  *
@@ -496,7 +500,8 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
496
500
  */
497
501
  constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
498
502
  startTransition: StartTransitionFn;
499
- isShell(): boolean | undefined;
503
+ isShell(): boolean;
504
+ isPrerendering(): boolean;
500
505
  update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
501
506
  get state(): RouterState<TRouteTree, import('./Matches.cjs').RouteMatch<any, any, any, any, any, any, any>>;
502
507
  buildRouteTree: () => void;
@@ -253,6 +253,10 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
253
253
  * @default false
254
254
  */
255
255
  isShell?: boolean;
256
+ /**
257
+ * @default false
258
+ */
259
+ isPrerendering?: boolean;
256
260
  /**
257
261
  * The default `ssr` a route should use if no `ssr` is provided.
258
262
  *
@@ -496,7 +500,8 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
496
500
  */
497
501
  constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
498
502
  startTransition: StartTransitionFn;
499
- isShell(): boolean | undefined;
503
+ isShell(): boolean;
504
+ isPrerendering(): boolean;
500
505
  update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
501
506
  get state(): RouterState<TRouteTree, import('./Matches.js').RouteMatch<any, any, any, any, any, any, any>>;
502
507
  buildRouteTree: () => void;
@@ -708,11 +708,9 @@ class RouterCore {
708
708
  return updated;
709
709
  };
710
710
  this.getMatch = (matchId) => {
711
- return [
712
- ...this.state.cachedMatches,
713
- ...this.state.pendingMatches ?? [],
714
- ...this.state.matches
715
- ].find((d) => d.id === matchId);
711
+ var _a;
712
+ const findFn = (d) => d.id === matchId;
713
+ return this.state.cachedMatches.find(findFn) ?? ((_a = this.state.pendingMatches) == null ? void 0 : _a.find(findFn)) ?? this.state.matches.find(findFn);
716
714
  };
717
715
  this.loadMatches = async ({
718
716
  location,
@@ -1279,7 +1277,10 @@ class RouterCore {
1279
1277
  return true;
1280
1278
  }
1281
1279
  const gcTime = (d.preload ? route.options.preloadGcTime ?? this.options.defaultPreloadGcTime : route.options.gcTime ?? this.options.defaultGcTime) ?? 5 * 60 * 1e3;
1282
- return !(d.status !== "error" && Date.now() - d.updatedAt < gcTime);
1280
+ const isError = d.status === "error";
1281
+ if (isError) return true;
1282
+ const isStale = Date.now() - d.updatedAt >= gcTime;
1283
+ return isStale;
1283
1284
  };
1284
1285
  this.clearCache({ filter });
1285
1286
  };
@@ -1457,7 +1458,10 @@ class RouterCore {
1457
1458
  }
1458
1459
  }
1459
1460
  isShell() {
1460
- return this.options.isShell;
1461
+ return !!this.options.isShell;
1462
+ }
1463
+ isPrerendering() {
1464
+ return !!this.options.isPrerendering;
1461
1465
  }
1462
1466
  get state() {
1463
1467
  return this.__store.state;