function / @typed/template/Render

attemptHydration

Locates a compatible SSR template range for an advanced render context.

Package version
1.0.0-beta.7
Category
DOM adoption
Since
1.0.0

Import

import { attemptHydration } from "@typed/template/Render";

Signatures

export declare function attemptHydration(ctx: TemplateContext, hash: string): {
    readonly where: HydrationTemplate;
    readonly hydrateCtx: HydrateContext;
} | undefined;

Why

Hydration is a precise marker-and-hash match, not a promise to reconcile any arbitrary existing HTML. A missing compatible range disables hydration for the context and lets normal DOM construction proceed.

Ownership and lifetime

The returned range and context are borrowed from the active render Scope. This function does not acquire nodes, attach events, or sanitize markup.

Examples

import { attemptHydration } from "@typed/template/Render"
import type { TemplateContext } from "@typed/template/Render"

declare const context: TemplateContext
const match = attemptHydration(context, "template-hash")

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source