firstValueFrom()
Resolve the first DATA from a Node as a Promise.
Import
Section titled “Import”import { firstValueFrom } from "@graphrefly/ts/sources";Signature
Section titled “Signature”function firstValueFrom(source: Node<T>): Promise<T>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
source | Node<T> | Node to subscribe to. |
Returns
Section titled “Returns”A Promise for the first DATA value, or a rejection on ERROR/early completion.
Example
Section titled “Example”import { graph } from "@graphrefly/ts/graph";import { firstValueFrom } from "@graphrefly/ts/sources";
const g = graph();await firstValueFrom(g.state(1));Remarks
Section titled “Remarks”- Host-boundary escape hatch only. Do not call it from reactive node bodies; use graph deps/messages there so the topology remains declarative and inspectable.
Source
Section titled “Source”packages/ts/src/graph/sources.ts