tanstack-router-cache 0.1.8 → 0.1.9
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/index.d.ts +1 -1
- package/dist/route-cache-static-data.d.ts +22 -2
- package/dist/types.d.ts +0 -22
- package/docs/types.md +0 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { RouteCacheStaticOption } from "./types";
|
|
|
2
2
|
export { RouterCacheOutlet } from "./components/router-cache-outlet";
|
|
3
3
|
export type { CachedRouteData, CachedRoutes } from "./contexts/router-cache";
|
|
4
4
|
export { RouterCacheProvider } from "./contexts/router-cache";
|
|
5
|
-
export { defineRouteCache } from "./route-cache-static-data";
|
|
6
5
|
export { useRouteCacheActive } from "./hooks/use-route-cache-active";
|
|
7
6
|
export { useRouteCacheActivity } from "./hooks/use-route-cache-activity";
|
|
8
7
|
export { useRouteCacheEffect } from "./hooks/use-route-cache-effect";
|
|
9
8
|
export { useRouteCacheErrorBoundary } from "./hooks/use-route-cache-error-boundary";
|
|
10
9
|
export { useRouteCacheNavigation } from "./hooks/use-route-cache-navigation";
|
|
11
10
|
export { useRouterCache } from "./hooks/use-router-cache";
|
|
11
|
+
export { defineRouteCache } from "./route-cache-static-data";
|
|
12
12
|
export type * from "./types";
|
|
13
13
|
declare module "@tanstack/react-router" {
|
|
14
14
|
interface StaticDataRouteOption {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StaticDataRouteOption } from "@tanstack/react-router";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RouteCacheOptions } from "./types";
|
|
3
3
|
type CachedRouteTiming = {
|
|
4
4
|
createdAt?: number;
|
|
5
5
|
staticData: StaticDataRouteOption;
|
|
@@ -10,7 +10,27 @@ type CachedRouteTiming = {
|
|
|
10
10
|
* TanStack Router loader-cache options are returned at the route-option level,
|
|
11
11
|
* while route-cache-specific options are stored under `staticData.routeCache`.
|
|
12
12
|
*/
|
|
13
|
-
export declare function defineRouteCache(options?:
|
|
13
|
+
export declare function defineRouteCache(options?: RouteCacheOptions & {
|
|
14
|
+
/**
|
|
15
|
+
* TanStack Router loader garbage-collection time, in milliseconds.
|
|
16
|
+
*
|
|
17
|
+
* This is returned as a top-level route option.
|
|
18
|
+
*/
|
|
19
|
+
gcTime?: number;
|
|
20
|
+
/**
|
|
21
|
+
* TanStack Router preload freshness time, in milliseconds.
|
|
22
|
+
*
|
|
23
|
+
* This is returned as a top-level route option.
|
|
24
|
+
*/
|
|
25
|
+
preloadStaleTime?: number;
|
|
26
|
+
/**
|
|
27
|
+
* TanStack Router loader freshness time, in milliseconds.
|
|
28
|
+
*
|
|
29
|
+
* This is returned as a top-level route option and does not control the
|
|
30
|
+
* retained route view lifetime. Use `maxAge` for that.
|
|
31
|
+
*/
|
|
32
|
+
staleTime?: number;
|
|
33
|
+
}): {
|
|
14
34
|
staticData: {
|
|
15
35
|
routeCache: boolean | {
|
|
16
36
|
maxAge: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -20,28 +20,6 @@ export type RouteCacheOptions = {
|
|
|
20
20
|
* when the retained view needs route-cache-specific options.
|
|
21
21
|
*/
|
|
22
22
|
export type RouteCacheStaticOption = boolean | RouteCacheOptions;
|
|
23
|
-
/** Options accepted by `defineRouteCache`. */
|
|
24
|
-
export type RouteCacheRouteOptions = RouteCacheOptions & {
|
|
25
|
-
/**
|
|
26
|
-
* TanStack Router loader garbage-collection time, in milliseconds.
|
|
27
|
-
*
|
|
28
|
-
* This is returned as a top-level route option.
|
|
29
|
-
*/
|
|
30
|
-
gcTime?: number;
|
|
31
|
-
/**
|
|
32
|
-
* TanStack Router preload freshness time, in milliseconds.
|
|
33
|
-
*
|
|
34
|
-
* This is returned as a top-level route option.
|
|
35
|
-
*/
|
|
36
|
-
preloadStaleTime?: number;
|
|
37
|
-
/**
|
|
38
|
-
* TanStack Router loader freshness time, in milliseconds.
|
|
39
|
-
*
|
|
40
|
-
* This is returned as a top-level route option and does not control the
|
|
41
|
-
* retained route view lifetime. Use `maxAge` for that.
|
|
42
|
-
*/
|
|
43
|
-
staleTime?: number;
|
|
44
|
-
};
|
|
45
23
|
/** Emitted when navigation to a ready cached route begins. */
|
|
46
24
|
export type RouteCacheNavigationStart = {
|
|
47
25
|
/** Normalized pathname for the cached route being restored. */
|
package/docs/types.md
CHANGED
|
@@ -11,12 +11,6 @@ export type RouteCacheOptions = {
|
|
|
11
11
|
|
|
12
12
|
export type RouteCacheStaticOption = boolean | RouteCacheOptions;
|
|
13
13
|
|
|
14
|
-
export type RouteCacheRouteOptions = RouteCacheOptions & {
|
|
15
|
-
gcTime?: number;
|
|
16
|
-
preloadStaleTime?: number;
|
|
17
|
-
staleTime?: number;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
export type RouteCacheNavigationStart = {
|
|
21
15
|
pathname: string;
|
|
22
16
|
startedAt: number;
|