tanstack-router-cache 0.1.9 → 0.1.10

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.
@@ -1,5 +1,4 @@
1
1
  import type { StaticDataRouteOption } from "@tanstack/react-router";
2
- import type { RouteCacheOptions } from "./types";
3
2
  type CachedRouteTiming = {
4
3
  createdAt?: number;
5
4
  staticData: StaticDataRouteOption;
@@ -10,7 +9,17 @@ type CachedRouteTiming = {
10
9
  * TanStack Router loader-cache options are returned at the route-option level,
11
10
  * while route-cache-specific options are stored under `staticData.routeCache`.
12
11
  */
13
- export declare function defineRouteCache(options?: RouteCacheOptions & {
12
+ export declare function defineRouteCache(options?: {
13
+ /**
14
+ * Maximum age, in milliseconds, for a retained route view.
15
+ *
16
+ * Expired cached views are not restored. This only controls the retained
17
+ * mounted view; use TanStack Router's `staleTime`, `preloadStaleTime`,
18
+ * and `gcTime` route options for loader-data caching.
19
+ *
20
+ * @defaultValue `Infinity`
21
+ */
22
+ maxAge?: number;
14
23
  /**
15
24
  * TanStack Router loader garbage-collection time, in milliseconds.
16
25
  *
package/dist/types.d.ts CHANGED
@@ -1,25 +1,23 @@
1
1
  /** Visibility mode for a cached route container. */
2
2
  export type ActivityMode = "visible" | "hidden";
3
- /** Route-cache options stored in TanStack Router `staticData.routeCache`. */
4
- export type RouteCacheOptions = {
3
+ /**
4
+ * Static route-cache opt-in value.
5
+ *
6
+ * Use `true` to keep the route view cached with default behavior, or an object
7
+ * when the retained view needs route-cache-specific options.
8
+ */
9
+ export type RouteCacheStaticOption = boolean | {
5
10
  /**
6
11
  * Maximum age, in milliseconds, for a retained route view.
7
12
  *
8
13
  * Expired cached views are not restored. This only controls the retained
9
- * mounted view; use TanStack Router's `staleTime`, `preloadStaleTime`, and
10
- * `gcTime` route options for loader-data caching.
14
+ * mounted view; use TanStack Router's `staleTime`, `preloadStaleTime`,
15
+ * and `gcTime` route options for loader-data caching.
11
16
  *
12
17
  * @defaultValue `Infinity`
13
18
  */
14
19
  maxAge?: number;
15
20
  };
16
- /**
17
- * Static route-cache opt-in value.
18
- *
19
- * Use `true` to keep the route view cached with default behavior, or an object
20
- * when the retained view needs route-cache-specific options.
21
- */
22
- export type RouteCacheStaticOption = boolean | RouteCacheOptions;
23
21
  /** Emitted when navigation to a ready cached route begins. */
24
22
  export type RouteCacheNavigationStart = {
25
23
  /** Normalized pathname for the cached route being restored. */
package/docs/types.md CHANGED
@@ -5,11 +5,11 @@
5
5
  ```ts
6
6
  export type ActivityMode = "visible" | "hidden";
7
7
 
8
- export type RouteCacheOptions = {
9
- maxAge?: number;
10
- };
11
-
12
- export type RouteCacheStaticOption = boolean | RouteCacheOptions;
8
+ export type RouteCacheStaticOption =
9
+ | boolean
10
+ | {
11
+ maxAge?: number;
12
+ };
13
13
 
14
14
  export type RouteCacheNavigationStart = {
15
15
  pathname: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tanstack-router-cache",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Route view caching for TanStack Router.",
5
5
  "type": "module",
6
6
  "license": "MIT",