@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/dist/cjs/router.cjs +7 -6
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +7 -6
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +11 -6
package/dist/esm/router.js
CHANGED
|
@@ -708,11 +708,9 @@ class RouterCore {
|
|
|
708
708
|
return updated;
|
|
709
709
|
};
|
|
710
710
|
this.getMatch = (matchId) => {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
|
|
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
|
};
|