Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / transaction

Function: transaction() ​

transaction<T>(fn): T

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:365

Groups synchronous atom writes into one reactive state transition.

Writes are visible synchronously through .value, but subscriber delivery and dependent recomputation are deferred until the outermost transaction commits. Nested transactions join the outer transaction. Errors do not roll state back: queued changes are committed before the original error is rethrown.

Async callbacks are intentionally unsupported. Resolve async work first, then apply its result inside a synchronous transaction.

Type Parameters ​

T ​

T

Parameters ​

fn ​

() => T extends PromiseLike<any> ? never : T

Returns ​

T

Released under the MIT License.