Skip to main content

Action mixins

You can add mixins to your actions to handle common tasks. For example, instead of writing:

class LoadText extends AppAction { ...

You can add with CheckInternet to check for internet connectivity:

class LoadText extends AppAction with CheckInternet { ...

Or even combine multiple mixins:

class LoadText extends AppAction with CheckInternet, NonReentrant, Retry { ...

All available mixins

MixinPurposeOverrides
CheckInternetChecks internet before action; shows dialog if no connectionbefore
NoDialogModifier for CheckInternet to suppress dialog(requires CheckInternet)
AbortWhenNoInternetChecks internet before action; aborts silently if no connectionbefore
NonReentrantAborts if the same action is already runningabortDispatch
RetryRetries the action on error with exponential backoffwrapReduce
UnlimitedRetriesModifier for Retry to retry indefinitely(requires Retry)
UnlimitedRetryCheckInternetCombines internet check + unlimited retry + non-reentrantabortDispatch, wrapReduce
ThrottleLimits action execution to at most once per throttle periodabortDispatch, after
DebounceDelays execution until after a period of inactivitywrapReduce
FreshSkips action if data is still fresh (not stale)abortDispatch, after
OptimisticCommandApplies state changes optimistically, rolls back on errorreduce
OptimisticSyncOptimistic updates with coalescing; merges rapid dispatches into one syncreduce
OptimisticSyncWithPushLike OptimisticSync but with revision tracking for server pushesreduce
ServerPushHandles server-pushed updates for OptimisticSyncWithPushreduce

Compatibility matrix

Not all mixins can be combined. AsyncRedux throws an exception if you try to use incompatible mixins together, and in some cases it will warn you at compile time.

Check
Internet
No
Dialog
Abort
When
No
Internet
Non
Reentrant
RetryUnlimited
Retries
Unlimited
Retry
Check
Internet
ThrottleDebounceFreshOptimistic
Command
Optimistic
Sync
Optimistic
Sync
WithPush
Server
Push
CheckInternet✅️✅️
NoDialog➡️✅️✅️
AbortWhenNoInternet✅️✅️
NonReentrant
Retry✅️✅️✅️
UnlimitedRetries✅️✅️✅️➡️
UnlimitedRetryCheckInternet
Throttle
Debounce
Fresh
OptimisticCommand
OptimisticSync
OptimisticSyncWithPush
ServerPush

✅ Compatible (can be combined)

❌ Incompatible (cannot be combined)

➡️ Requires (must be used together)


All mixins will be explained in detail in the following pages: