API reference > @kontsedal/olas-react > createStreamingHydrator
createStreamingHydrator() function
Server-side hydrator. Captures every committed write — a fetch resolving, a canonical write or replace, an optimistic layer committed as server truth — through the plugin onWrite hook, then serializes captured entries to inline <script> tags via flush(). An infinite query's entry carries its pages and their pageParams, so the client continues paging from where the server stopped.
Hydration, optimistic writes and rollbacks are not captured: the first is data the client already has, and the other two are a guess the server never confirmed and its undoing. A 'commit' is captured, because it is the data the server rendered once no guess is left.
The payload is serialized with serializeForScript: JSON.parse over a fully escaped string, so query data cannot end the script, form markup, or turn a __proto__ key into a prototype on the client.
Signature:
export declare function createStreamingHydrator(options?: StreamingHydratorOptions): StreamingHydrator;Parameters
Parameter | Type | Description |
|---|---|---|
options | (Optional) |
Returns: