@tanstack/router-core 1.130.2 → 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.2",
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
@@ -2078,11 +2078,12 @@ export class RouterCore<
2078
2078
  }
2079
2079
 
2080
2080
  getMatch: GetMatchFn = (matchId: string) => {
2081
- return [
2082
- ...this.state.cachedMatches,
2083
- ...(this.state.pendingMatches ?? []),
2084
- ...this.state.matches,
2085
- ].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
+ )
2086
2087
  }
2087
2088
 
2088
2089
  loadMatches = async ({
@@ -2867,7 +2868,11 @@ export class RouterCore<
2867
2868
  : (route.options.gcTime ?? this.options.defaultGcTime)) ??
2868
2869
  5 * 60 * 1000
2869
2870
 
2870
- 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
2871
2876
  }
2872
2877
  this.clearCache({ filter })
2873
2878
  }