Open History to see the last commit
1---
2id: DehydrateOptions
3title: DehydrateOptions
4---
5β
6Defined in: [packages/query-core/src/hydration.ts:49](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L49)
7β
8Options for `dehydrate`, controlling which queries/mutations are included in the resulting `DehydratedState` and
9how their data/errors are transformed before being serialized (e.g. for embedding in server-rendered markup).
10β
11## Properties
12β
13| Property | Type | Description |
14| ------ | ------ | ------ |
15| <a id="property-serializedata"></a> `serializeData?` | `TransformerFn` | Transforms a query's `data` before it is dehydrated. Useful for non-JSON-serializable data. |
16| <a id="property-shoulddehydratemutation"></a> `shouldDehydrateMutation?` | (`mutation`: [`Mutation`](../classes/Mutation.md)) => `boolean` | Predicate to decide whether a given `Mutation` should be dehydrated. Defaults to `defaultShouldDehydrateMutation`. |
17| <a id="property-shoulddehydratequery"></a> `shouldDehydrateQuery?` | (`query`: [`Query`](../classes/Query.md)) => `boolean` | Predicate to decide whether a given `Query` should be dehydrated. Defaults to `defaultShouldDehydrateQuery`. |
18| <a id="property-shouldredacterrors"></a> `shouldRedactErrors?` | (`error`: `unknown`) => `boolean` | Predicate to decide whether a query's error should be redacted before dehydration. Errors are redacted (replaced with a generic `Error('redacted')`) unless this function is provided and returns `false` for the given error, in which case the original error is kept. |