# RefSubject.HydrationRef

Defines the hydration ref state contract.

## Signatures

```ts
export interface HydrationRef<E = never, R = never> {
    (element: HydrationElement): Effect.Effect<void, never, R | Scope.Scope>;
    readonly [HydrationRefTypeId]: {
        readonly members: ReadonlyArray<HydrationMember>;
        readonly server: Effect.Effect<void>;
        readonly toAttributes: Effect.Effect<ReadonlyArray<HydrationAttribute>, E, R>;
    };
}
```

## Why

Makes a state boundary callable with an attribute host while also exposing server serialization
as ordinary typed Effects.

## Ownership and lifetime

HydrationRef is a contract and performs no acquisition. Implementations retain the errors,
services, interruption, and Scope requirements expressed by its members.

## Call signatures

Restores every member from a DOM-compatible attribute host.

## Call signatures: Why

Reads and removes encoded attributes, decodes them with each member's Schema, and completes the
deferred client initializer before ordinary state observation resumes.

## Call signatures: Ownership and lifetime

Running the Effect requires Scope for deferred restoration and member subscriptions. Missing
attributes resume the original initializer; Schema failures and codec services remain on the
member metadata rather than becoming DOM exceptions.

## Property: [[computed:[HydrationRefTypeId]]]

Exposes the members and Effects used for serialization and restoration.

## Property: [[computed:[HydrationRefTypeId]]]: Why

Keeps server serialization discoverable without changing the RefSubject prototype or requiring
a renderer-specific wrapper.

## Property: [[computed:[HydrationRefTypeId]]]: Ownership and lifetime

The operation starts only when its Effect is run. Any subscription or deferred hydration work is
finalized by the required Scope.
