tanstack-router-cache 0.1.0
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/LICENSE +22 -0
- package/README.md +84 -0
- package/dist/components/cached-outlet.d.ts +8 -0
- package/dist/components/off-screen-in.d.ts +9 -0
- package/dist/components/off-screen.d.ts +4 -0
- package/dist/components/restore-cached-href.d.ts +10 -0
- package/dist/components/route-cache-manager.d.ts +2 -0
- package/dist/components/router-cache-outlet.d.ts +4 -0
- package/dist/contexts/router-cache.d.ts +36 -0
- package/dist/dom/dismiss-transient-ui.d.ts +3 -0
- package/dist/hooks/use-event-listener.d.ts +36 -0
- package/dist/hooks/use-route-cache-active.d.ts +1 -0
- package/dist/hooks/use-route-cache-activity.d.ts +1 -0
- package/dist/hooks/use-route-cache-effect.d.ts +2 -0
- package/dist/hooks/use-route-cache-error-boundary.d.ts +1 -0
- package/dist/hooks/use-route-cache-navigation.d.ts +7 -0
- package/dist/hooks/use-router-cache-debug.d.ts +24 -0
- package/dist/hooks/use-router-cache.d.ts +10 -0
- package/dist/hooks/use-update.d.ts +1 -0
- package/dist/index.cjs +66 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -0
- package/dist/pathname.d.ts +1 -0
- package/dist/types.d.ts +10 -0
- package/docs/architecture.md +503 -0
- package/docs/cache-behavior.md +28 -0
- package/docs/components.md +41 -0
- package/docs/debugging.md +31 -0
- package/docs/getting-started.md +151 -0
- package/docs/hooks.md +187 -0
- package/docs/types.md +37 -0
- package/docs/usage.md +11 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Original work Copyright (c) NOW hemengke1997
|
|
4
|
+
Modifications Copyright (c) 2026 Santiago Ramos
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# tanstack-router-cache
|
|
2
|
+
|
|
3
|
+
Route view caching for [`@tanstack/react-router`](https://tanstack.com/router).
|
|
4
|
+
|
|
5
|
+
`tanstack-router-cache` keeps selected route trees mounted while they are hidden, then restores them when the user navigates back. Use it for tab-like workflows, long forms, filtered lists, scroll positions, and page state that should survive route changes without moving everything into global state.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
bun add tanstack-router-cache
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install tanstack-router-cache
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Consumer requirements
|
|
18
|
+
|
|
19
|
+
Your app should already use React and TanStack Router. This package keeps them as peer dependencies so it does not install a second router or React runtime.
|
|
20
|
+
|
|
21
|
+
| Package | Supported versions |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `react` | `>=19.0.0 <20.0.0` |
|
|
24
|
+
| `react-dom` | Match your React version. |
|
|
25
|
+
| `@tanstack/react-router` | `>=1.168.14 <2.0.0` |
|
|
26
|
+
|
|
27
|
+
## Maintenance
|
|
28
|
+
|
|
29
|
+
This package is intended to stay compatible with current TanStack Router 1.x releases. The peer dependency floor is tested against the oldest version supported by the current implementation, while development tracks the latest compatible TanStack Router version.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Wrap the route tree that should support retention:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { RouterCacheOutlet, RouterCacheProvider } from "tanstack-router-cache";
|
|
37
|
+
|
|
38
|
+
export function RootRoute() {
|
|
39
|
+
return (
|
|
40
|
+
<RouterCacheProvider maxEntries={8} maxEntriesPerRouteId={2}>
|
|
41
|
+
<RouterCacheOutlet />
|
|
42
|
+
</RouterCacheProvider>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Enable caching on a route:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
export const Route = createFileRoute("/customers")({
|
|
51
|
+
staticData: {
|
|
52
|
+
routeCache: true,
|
|
53
|
+
},
|
|
54
|
+
component: CustomersPage,
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Run work only while a retained route is visible:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { useRouteCacheEffect } from "tanstack-router-cache";
|
|
62
|
+
|
|
63
|
+
function CustomersPage() {
|
|
64
|
+
useRouteCacheEffect(() => {
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
|
|
67
|
+
return () => {
|
|
68
|
+
controller.abort();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
return <CustomersTable />;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
More usage details are in [docs/usage.md](./docs/usage.md).
|
|
77
|
+
|
|
78
|
+
## Acknowledgements
|
|
79
|
+
|
|
80
|
+
This project originated from [`hemengke1997/tanstack-router-keepalive`](https://github.com/hemengke1997/tanstack-router-keepalive). The implementation has since diverged substantially, including current TanStack Router compatibility, cache limits, error handling, navigation lifecycle instrumentation, dependency updates, and memory-focused eviction.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RouterContextProvider } from "@tanstack/react-router";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
type CachedOutletProps = {
|
|
4
|
+
matchId: string;
|
|
5
|
+
routerSnapshot: ComponentProps<typeof RouterContextProvider>["router"];
|
|
6
|
+
};
|
|
7
|
+
export default function CachedOutlet(props: Readonly<CachedOutletProps>): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
import type { ActivityMode } from "../types";
|
|
3
|
+
export type OffScreenInProps = {
|
|
4
|
+
mode: ActivityMode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
containerRef?: RefObject<HTMLDivElement | null>;
|
|
7
|
+
pathname?: string;
|
|
8
|
+
};
|
|
9
|
+
export default function OffScreenIn(props: Readonly<OffScreenInProps>): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type RestoreCachedHrefInput = {
|
|
2
|
+
cachedHref?: string;
|
|
3
|
+
currentHref?: string;
|
|
4
|
+
currentPathname: string;
|
|
5
|
+
isRouteCacheEnabled?: boolean;
|
|
6
|
+
previousPathname?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function isBareRouteHref(href: string | undefined, currentPathname: string): boolean;
|
|
9
|
+
export declare function shouldRestoreCachedHref({ cachedHref, currentHref, currentPathname, isRouteCacheEnabled, previousPathname, }: RestoreCachedHrefInput): boolean;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RouterContextProvider, StaticDataRouteOption } from "@tanstack/react-router";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
|
+
type RouterCacheProviderProps = {
|
|
4
|
+
cacheScopeKey?: string | number | null;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
defaultCachedRoutes?: CachedRoutes;
|
|
7
|
+
maxEntries?: number;
|
|
8
|
+
maxEntriesPerRouteId?: number;
|
|
9
|
+
};
|
|
10
|
+
type RouterSnapshot = ComponentProps<typeof RouterContextProvider>["router"];
|
|
11
|
+
export type CachedRouteData = {
|
|
12
|
+
createdAt?: number;
|
|
13
|
+
href?: string;
|
|
14
|
+
lastVisibleAt?: number;
|
|
15
|
+
routeId?: string;
|
|
16
|
+
staticData: StaticDataRouteOption;
|
|
17
|
+
matchId?: string;
|
|
18
|
+
routerSnapshot?: RouterSnapshot;
|
|
19
|
+
ready?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type CachedRoutes = {
|
|
22
|
+
[key: string]: CachedRouteData;
|
|
23
|
+
};
|
|
24
|
+
export type RouterCacheContextState = {
|
|
25
|
+
cachedRoutes: CachedRoutes;
|
|
26
|
+
erroredRouteCounts: Record<string, number>;
|
|
27
|
+
setCachedRoutes: (pathname: string, data: CachedRouteData) => void;
|
|
28
|
+
deleteCachedRoutes: (pathname: string[]) => void;
|
|
29
|
+
touchCachedRoutes: (pathname: string[]) => void;
|
|
30
|
+
retainErroredRoute: (pathname: string) => void;
|
|
31
|
+
releaseErroredRoute: (pathname: string) => void;
|
|
32
|
+
};
|
|
33
|
+
export declare function RouterCacheProvider({ cacheScopeKey, children, defaultCachedRoutes, maxEntries, maxEntriesPerRouteId, }: Readonly<RouterCacheProviderProps>): import("react").JSX.Element;
|
|
34
|
+
export declare function useRouterCacheContext(): RouterCacheContextState;
|
|
35
|
+
export declare function useOptionalRouterCacheContext(): RouterCacheContextState | null;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function initializeTransientUiTracking(documentObject: Document): void;
|
|
2
|
+
export declare function syncTransientUiRouteActivity(pathname: string, mode: "hidden" | "visible"): void;
|
|
3
|
+
export declare function dismissTransientUi(container: HTMLElement | null, pathname: string): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ActivityMode, RouteCacheNavigationComplete, RouteCacheNavigationStart } from "../types";
|
|
2
|
+
type Events = {
|
|
3
|
+
activeChange: [
|
|
4
|
+
{
|
|
5
|
+
pathname: string;
|
|
6
|
+
mode: ActivityMode;
|
|
7
|
+
callback?: () => void;
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
cachedNavigationCancel: [RouteCacheNavigationStart];
|
|
11
|
+
cachedNavigationComplete: [RouteCacheNavigationComplete];
|
|
12
|
+
cachedNavigationStart: [RouteCacheNavigationStart];
|
|
13
|
+
};
|
|
14
|
+
type EventName = keyof Events;
|
|
15
|
+
type EventHandler<TName extends EventName> = (...args: Events[TName]) => void;
|
|
16
|
+
type EventBucket = {
|
|
17
|
+
[key in EventName]?: EventHandler<key>;
|
|
18
|
+
};
|
|
19
|
+
type EventBuckets = {
|
|
20
|
+
on?: EventBucket;
|
|
21
|
+
once?: EventBucket;
|
|
22
|
+
};
|
|
23
|
+
declare class RouterCacheEvent {
|
|
24
|
+
private static instance;
|
|
25
|
+
private readonly listeners;
|
|
26
|
+
private constructor();
|
|
27
|
+
static getInstance(): RouterCacheEvent;
|
|
28
|
+
on<TName extends EventName>(eventName: TName, handler: EventHandler<TName>): this;
|
|
29
|
+
once<TName extends EventName>(eventName: TName, handler: EventHandler<TName>): this;
|
|
30
|
+
off<TName extends EventName>(eventName: TName, handler: EventHandler<TName>): this;
|
|
31
|
+
emit<TName extends EventName>(eventName: TName, ...args: Events[TName]): boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function useEventListener(events?: EventBuckets): {
|
|
34
|
+
eventListener: RouterCacheEvent;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRouteCacheActive(pathname?: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRouteCacheActivity(fn: (active: boolean) => void): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRouteCacheErrorBoundary(pathname?: string): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RouteCacheNavigationComplete, RouteCacheNavigationStart } from "../types";
|
|
2
|
+
type RouteCacheNavigationState = {
|
|
3
|
+
activeNavigation: RouteCacheNavigationStart | null;
|
|
4
|
+
lastCompletedNavigation: RouteCacheNavigationComplete | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function useRouteCacheNavigation(): RouteCacheNavigationState;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CachedRoutes } from "../contexts/router-cache";
|
|
2
|
+
type RouterCacheDebugSnapshot = {
|
|
3
|
+
cachedRoutePathnames: string[];
|
|
4
|
+
dynamicLookingRouteCount: number;
|
|
5
|
+
dynamicLookingRoutePathnames: string[];
|
|
6
|
+
hiddenCachedRouteCount: number;
|
|
7
|
+
hiddenContainerCount: number;
|
|
8
|
+
totalCachedRouteCount: number;
|
|
9
|
+
visiblePathname: string;
|
|
10
|
+
};
|
|
11
|
+
type RouterCacheDebugApi = {
|
|
12
|
+
getSnapshot: () => RouterCacheDebugSnapshot;
|
|
13
|
+
lastSnapshot?: RouterCacheDebugSnapshot;
|
|
14
|
+
refresh: () => RouterCacheDebugSnapshot;
|
|
15
|
+
setWarningThreshold: (nextThreshold?: number | null) => void;
|
|
16
|
+
warningThreshold?: number | null;
|
|
17
|
+
};
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
__TANSTACK_ROUTER_CACHE_DEBUG__?: RouterCacheDebugApi;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare function useRouterCacheDebug(cachedRoutes: CachedRoutes, visiblePathname: string): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CachedRouteData } from "../contexts/router-cache";
|
|
2
|
+
type InvalidateWherePredicate = (pathname: string, route: CachedRouteData) => boolean;
|
|
3
|
+
export declare function useRouterCache(): {
|
|
4
|
+
cachedRoutes: import("..").CachedRoutes;
|
|
5
|
+
destroy: (pathname: string | string[]) => void;
|
|
6
|
+
destroyAll: () => void;
|
|
7
|
+
invalidateWhere: (predicate: InvalidateWherePredicate) => string[];
|
|
8
|
+
isCached: (pathname: string) => boolean;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useUpdate(): () => void;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let src_components_router_cache_outlet_tsx = require("./components/router-cache-outlet.tsx");
|
|
3
|
+
let src_contexts_router_cache_tsx = require("./contexts/router-cache.tsx");
|
|
4
|
+
let src_hooks_use_route_cache_active_ts = require("./hooks/use-route-cache-active.ts");
|
|
5
|
+
let src_hooks_use_route_cache_activity_ts = require("./hooks/use-route-cache-activity.ts");
|
|
6
|
+
let src_hooks_use_route_cache_effect_ts = require("./hooks/use-route-cache-effect.ts");
|
|
7
|
+
let src_hooks_use_route_cache_error_boundary_ts = require("./hooks/use-route-cache-error-boundary.ts");
|
|
8
|
+
let src_hooks_use_route_cache_navigation_ts = require("./hooks/use-route-cache-navigation.ts");
|
|
9
|
+
let src_hooks_use_router_cache_ts = require("./hooks/use-router-cache.ts");
|
|
10
|
+
Object.defineProperty(exports, "RouterCacheOutlet", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return src_components_router_cache_outlet_tsx.RouterCacheOutlet;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "RouterCacheProvider", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return src_contexts_router_cache_tsx.RouterCacheProvider;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "useRouteCacheActive", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return src_hooks_use_route_cache_active_ts.useRouteCacheActive;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "useRouteCacheActivity", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function() {
|
|
31
|
+
return src_hooks_use_route_cache_activity_ts.useRouteCacheActivity;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "useRouteCacheEffect", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function() {
|
|
37
|
+
return src_hooks_use_route_cache_effect_ts.useRouteCacheEffect;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "useRouteCacheErrorBoundary", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function() {
|
|
43
|
+
return src_hooks_use_route_cache_error_boundary_ts.useRouteCacheErrorBoundary;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "useRouteCacheNavigation", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function() {
|
|
49
|
+
return src_hooks_use_route_cache_navigation_ts.useRouteCacheNavigation;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "useRouterCache", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function() {
|
|
55
|
+
return src_hooks_use_router_cache_ts.useRouterCache;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var src_types_ts = require("./types.ts");
|
|
59
|
+
Object.keys(src_types_ts).forEach(function(k) {
|
|
60
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function() {
|
|
63
|
+
return src_types_ts[k];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { RouterCacheOutlet } from "./components/router-cache-outlet";
|
|
2
|
+
export type { CachedRouteData, CachedRoutes } from "./contexts/router-cache";
|
|
3
|
+
export { RouterCacheProvider } from "./contexts/router-cache";
|
|
4
|
+
export { useRouteCacheActive } from "./hooks/use-route-cache-active";
|
|
5
|
+
export { useRouteCacheActivity } from "./hooks/use-route-cache-activity";
|
|
6
|
+
export { useRouteCacheEffect } from "./hooks/use-route-cache-effect";
|
|
7
|
+
export { useRouteCacheErrorBoundary } from "./hooks/use-route-cache-error-boundary";
|
|
8
|
+
export { useRouteCacheNavigation } from "./hooks/use-route-cache-navigation";
|
|
9
|
+
export { useRouterCache } from "./hooks/use-router-cache";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
declare module "@tanstack/react-router" {
|
|
12
|
+
interface StaticDataRouteOption {
|
|
13
|
+
routeCache?: boolean;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RouterCacheOutlet } from "./components/router-cache-outlet.tsx";
|
|
2
|
+
import { RouterCacheProvider } from "./contexts/router-cache.tsx";
|
|
3
|
+
import { useRouteCacheActive } from "./hooks/use-route-cache-active.ts";
|
|
4
|
+
import { useRouteCacheActivity } from "./hooks/use-route-cache-activity.ts";
|
|
5
|
+
import { useRouteCacheEffect } from "./hooks/use-route-cache-effect.ts";
|
|
6
|
+
import { useRouteCacheErrorBoundary } from "./hooks/use-route-cache-error-boundary.ts";
|
|
7
|
+
import { useRouteCacheNavigation } from "./hooks/use-route-cache-navigation.ts";
|
|
8
|
+
import { useRouterCache } from "./hooks/use-router-cache.ts";
|
|
9
|
+
export * from "./types.ts";
|
|
10
|
+
export { RouterCacheOutlet, RouterCacheProvider, useRouteCacheActive, useRouteCacheActivity, useRouteCacheEffect, useRouteCacheErrorBoundary, useRouteCacheNavigation, useRouterCache };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeCachedRoutePathname(pathname: string): string;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ActivityMode = "visible" | "hidden";
|
|
2
|
+
export type RouteCacheNavigationStart = {
|
|
3
|
+
pathname: string;
|
|
4
|
+
startedAt: number;
|
|
5
|
+
};
|
|
6
|
+
export type RouteCacheNavigationComplete = RouteCacheNavigationStart & {
|
|
7
|
+
duration: number;
|
|
8
|
+
paintedAt: number;
|
|
9
|
+
visibleAt: number;
|
|
10
|
+
};
|