Skip to main content
Version: 4.3

Transaction

type Transaction = <TResult>(callback, options?) => TResult;

Runs a callback as one atomic transaction: every graph edit inside it collapses into a single undo entry and a single React update (async edits split across awaits coalesce too).

Pass rollbackOnError: true to restore the graph to its pre-transaction state when the callback throws or rejects (the error is always re-thrown), and deferPaint: true to defer paint on every bound paper so views repaint once, on close. The callback may be sync or async; an async callback is awaited before the transaction closes and the call returns the pending promise.

Type Parameters

Type Parameter
TResult

Parameters

ParameterType
callback() => TResult
options?TransactionOptions

Returns

TResult

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub