function / @typed/fx

RefSubject.makeComputed

Builds a read-only Computed projection from a Versioned source.

Package version
2.0.0-beta.7
Category
Derived queries
Since
1.18.0
Member of
RefSubject

Import

import { RefSubject } from "@typed/fx";

Access RefSubject.makeComputed through the imported RefSubject export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export declare function makeComputed<R0, E0, A, E, R, E2, R2, C, E3, R3>(input: Versioned.Versioned<R0, E0, A, E, R, A, E2, R2>, f: (a: A) => Effect.Effect<C, E3, R3>): Computed<C, E0 | E | E2 | E3, R0 | R2 | R3 | Exclude<R, Scope.Scope>>;

Why

Applies the same Effectful projection to current reads and pushed versions, preserving all three Versioned channels without granting writes to the source.

Ownership and lifetime

Current reads cache the transformed input by source version within each Effect Context. The pushed channel uses Subject.hold: observers with the same Context object share one upstream session and its retained projection; distinct Context objects have separate sessions. The last observer ends its session and clears its held value. The observing Scope owns cleanup.

Other public imports

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

Source