Skip to main content

Function: transactionMiddleware()

function transactionMiddleware<M>(target): ActionMiddlewareDisposer;

Creates a transaction middleware, which reverts changes made by an action / child actions when the root action throws an exception, restoring the values those changes replaced.

Type Parameters​

Type ParameterDescription
M extends AnyModelModel

Parameters​

ParameterTypeDescription
target{ actionName: keyof M; model: M; }Object with the root target model object (model) and root action name (actionName).
target.actionNamekeyof M-
target.modelM-

Returns​

ActionMiddlewareDisposer

The middleware disposer.