createTransientCollection

Creates a channel carrying one reading per mark per environment, such as a legend row for each heatmap.

@internote/canvas-sdkFunction
On this page
import { createTransientCollection } from '@internote/canvas-sdk';

The snapshot is rebuilt on write and shared between reads, so useSyncExternalStore compares a stable array. The footer reads it with useTransientCollection.

#Signature

<T>(equal?: TransientEqual<T>): TransientCollection<T>

#Parameters

equal
Whether two readings of one member are the same, so a repeat does not wake subscribers. Absent compares by identity.

#Example

export const legendRows = createTransientCollection<LegendRow>((a, b) => a.min === b.min && a.max === b.max);

// In each heatmap mark:
legendRows.set(environmentKey, nodeKey(mark, index), { colour, min, max });

// In the footer panel:
const rows = useTransientCollection(legendRows, ctx);

Declared in packages/canvas-sdk/src/storage/transient.ts:170.

Last updated