Open History to see the last commit
1# @tanstack/angular-query-persist-client
2β
3Persistence integration for `@tanstack/angular-query`.
4β
5## Installation
6β
7```sh
8pnpm add @tanstack/angular-query-persist-client @tanstack/query-persist-client-core
9```
10β
11## Usage
12β
13```ts
14import { QueryClient, provideTanStackQuery } from '@tanstack/angular-query'
15import { withPersistQueryClient } from '@tanstack/angular-query-persist-client'
16β
17export const appConfig: ApplicationConfig = {
18 providers: [
19 provideTanStackQuery(
20 () => new QueryClient(),
21 withPersistQueryClient(() => ({
22 persistOptions: {
23 persister: createAsyncStoragePersister({ storage: localStorage }),
24 },
25 })),
26 ),
27 ],
28}
29```
30β
31The factory runs only in the browser and inside an Angular injection context.
32This makes it safe to access browser-only storage and inject application
33services without sharing persistence state between SSR requests.