Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

withHydrationKey.md

39 lines969 Bytes

1---
2id: withHydrationKey
3title: withHydrationKey
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8```ts
9function withHydrationKey(key: string): QueryFeature;
10```
11​
12Defined in: [packages/angular-query/src/providers.ts:198](https://github.com/TanStack/query/blob/main/packages/angular-query/src/providers.ts#L198)
13​
14Sets a non-default serialization key for this injector's `QueryClient` cache (server dehydrate /
15browser hydrate via `TransferState`). Use this when you have multiple `QueryClient` instances
16so each has its own key. The default key applies when you do not add this feature.
17​
18```ts
19providers: [
20 provideTanStackQuery(
21 () => new QueryClient(),
22 withHydrationKey('my-secondary-query-cache'),
23 ),
25```
26​
27## Parameters
28​
29### key
30​
31`string`
32​
33A unique string for this client's `TransferState` entry.
34​
35## Returns
36​
37[`QueryFeature`](../interfaces/QueryFeature.md)
38​
39A feature that stores this client's cache under the supplied key.