usePublishLiveValues

Publishes a set of computed values, keeping the store in step with what the component computed last.

@internote/canvas-sdk/reactHook
On this page
import { usePublishLiveValues } from '@internote/canvas-sdk/react';

A slot the component stops publishing while alive is cleared, so a value that becomes uncomputable reads as absent rather than stale. Unmounting clears nothing: an environment leaves the tree when its scene scrolls away, but its state persists, and clearing would flash every citation back to an em dash. The effect re-runs only when a value changes, however often the array is rebuilt.

#Signature

(entries: ReadonlyArray<LiveValueEntry>): void

#Parameters

entries
The values to publish, each [nodeId, member, value].

#Example

usePublishLiveValues(ctx.node.id ? [[ctx.node.id, 'area', area], [ctx.node.id, 'peak', peak]] : []);

Declared in packages/canvas-sdk/src/content/live-values.tsx:94.

Last updated