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

withHydrationKey.md

39 lines969 Bytes

function withHydrationKey(key: string): QueryFeature;

Defined in: packages/angular-query/src/providers.ts:198

Sets a non-default serialization key for this injector's QueryClient cache (server dehydrate / browser hydrate via TransferState). Use this when you have multiple QueryClient instances so each has its own key. The default key applies when you do not add this feature.

providers: [
  provideTanStackQuery(
    () => new QueryClient(),
    withHydrationKey('my-secondary-query-cache'),
  ),
]

Parameters

key

string

A unique string for this client's TransferState entry.

Returns

QueryFeature

A feature that stores this client's cache under the supplied key.