@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.130.1",
3
+ "version": "1.130.5",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/router.ts CHANGED
@@ -346,6 +346,11 @@ export interface RouterOptions<
346
346
  */
347
347
  isShell?: boolean
348
348
 
349
+ /**
350
+ * @default false
351
+ */
352
+ isPrerendering?: boolean
353
+
349
354
  /**
350
355
  * The default `ssr` a route should use if no `ssr` is provided.
351
356
  *
@@ -833,7 +838,11 @@ export class RouterCore<
833
838
  startTransition: StartTransitionFn = (fn) => fn()
834
839
 
835
840
  isShell() {
836
- return this.options.isShell
841
+ return !!this.options.isShell
842
+ }
843
+
844
+ isPrerendering() {
845
+ return !!this.options.isPrerendering
837
846
  }
838
847
 
839
848
  update: UpdateFn<
@@ -2069,11 +2078,12 @@ export class RouterCore<
2069
2078
  }
2070
2079
 
2071
2080
  getMatch: GetMatchFn = (matchId: string) => {
2072
- return [
2073
- ...this.state.cachedMatches,
2074
- ...(this.state.pendingMatches ?? []),
2075
- ...this.state.matches,
2076
- ].find((d) => d.id === matchId)
2081
+ const findFn = (d: { id: string }) => d.id === matchId
2082
+ return (
2083
+ this.state.cachedMatches.find(findFn) ??
2084
+ this.state.pendingMatches?.find(findFn) ??
2085
+ this.state.matches.find(findFn)
2086
+ )
2077
2087
  }
2078
2088
 
2079
2089
  loadMatches = async ({
@@ -2858,7 +2868,11 @@ export class RouterCore<
2858
2868
  : (route.options.gcTime ?? this.options.defaultGcTime)) ??
2859
2869
  5 * 60 * 1000
2860
2870
 
2861
- return !(d.status !== 'error' && Date.now() - d.updatedAt < gcTime)
2871
+ const isError = d.status === 'error'
2872
+ if (isError) return true
2873
+
2874
+ const isStale = Date.now() - d.updatedAt >= gcTime
2875
+ return isStale
2862
2876
  }
2863
2877
  this.clearCache({ filter })
2864
2878
  }