function dehydrateSettled(client: QueryClient, options?: DehydrateOptions): Promise<DehydratedState>;
Defined in: packages/solid-query/src/dehydrateSettled.ts:31
Waits for every fetch the client has in flight to settle, then
dehydrates. This is the extraction half of a single-flight collector:
after route data functions run for the mutation's target URL, loaders
commonly kick off prefetches without awaiting them β plain
dehydrate() would snapshot those mid-fetch and ship nothing.
registerFlightDataSource(FLIGHT_DATA_SOURCE, (event, outcome) =>
loadFlightTarget({
router,
event,
outcome,
collect: () => dehydrateSettled(queryClient),
}),
)
Settling is chased to quiescence β awaiting one batch of fetches can dispatch more (dependent queries keyed off a first result) β so an unconditionally self-refetching query would keep this pending; that's an app bug mirrored, not guarded.
Parameters#
client#
The QueryClient whose cache is dehydrated.
options?#
The DehydrateOptions forwarded to dehydrate.
options properties#
| Property | Type | Description |
|---|---|---|
serializeData? | TransformerFn | Transforms a query's data before it is dehydrated. Useful for non-JSON-serializable data. |
shouldDehydrateMutation? | (mutation: Mutation) => boolean | Predicate to decide whether a given Mutation should be dehydrated. Defaults to defaultShouldDehydrateMutation. |
shouldDehydrateQuery? | (query: Query) => boolean | Predicate to decide whether a given Query should be dehydrated. Defaults to defaultShouldDehydrateQuery. |
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. |
Returns#
Promise<DehydratedState>
A promise for the dehydrated state, taken once no fetch is in flight.
Result properties#
Built from DehydratedState. See the type above for what it changes.