0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
query/docs/framework/svelte/reference/functions/dehydrateQuery.md
Wonsuk Choi f38e6271b4
chore(*): update '@tanstack/typedoc-config' to v0.3.5 (#12035)
* chore(scripts/generate-docs): read type alias bodies whose type parameters have defaults

* chore(*): update '@tanstack/typedoc-config' to v0.3.5
2026-10-17 11:14:03 +09:00

1.3 KiB

id title
dehydrateQuery dehydrateQuery
function dehydrateQuery(
   query: Query, 
   serializeData?: TransformerFn, 
   shouldRedactErrors?: (error: unknown) => boolean
): DehydratedQuery;

Defined in: packages/query-core/src/hydration.ts:178

Dehydrates a single Query into a serializable DehydratedQuery snapshot. Note that most query config (e.g. queryFn, staleTime) is not dehydrated but instead meant to be configured again when consuming the de/rehydrated data, typically with useQuery on the client. If the query is still pending, its in-flight promise is dehydrated too so it can be resumed on the other side instead of re-fetched.

Parameters

query

Query

The query to dehydrate.

serializeData?

TransformerFn

Optional transform applied to query.state.data before it is included in the snapshot.

shouldRedactErrors?

(error: unknown) => boolean

Optional predicate; if it returns false for the promise's rejection error, that error is kept as-is instead of being redacted.

Returns

DehydratedQuery

The dehydrated query.