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
| Mixin | Purpose | Overrides |
|---|---|---|
| CheckInternet | Checks internet before action; shows dialog if no connection | before |
| NoDialog | Modifier for CheckInternet to suppress dialog | (requires CheckInternet) |
| AbortWhenNoInternet | Checks internet before action; aborts silently if no connection | before |
| NonReentrant | Aborts if the same action is already running | abortDispatch |
| Retry | Retries the action on error with exponential backoff | wrapReduce |
| UnlimitedRetries | Modifier for Retry to retry indefinitely | (requires Retry) |
| UnlimitedRetryCheckInternet | Combines internet check + unlimited retry + non-reentrant | abortDispatch, wrapReduce |
| Throttle | Limits action execution to at most once per throttle period | abortDispatch, after |
| Debounce | Delays execution until after a period of inactivity | wrapReduce |
| Fresh | Skips action if data is still fresh (not stale) | abortDispatch, after |
| OptimisticCommand | Applies state changes optimistically, rolls back on error | reduce |
| OptimisticSync | Optimistic updates with coalescing; merges rapid dispatches into one sync | reduce |
| OptimisticSyncWithPush | Like OptimisticSync but with revision tracking for server pushes | reduce |
| ServerPush | Handles server-pushed updates for OptimisticSyncWithPush | reduce |
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 | Retry | Unlimited Retries | Unlimited Retry Check Internet | Throttle | Debounce | Fresh | Optimistic Command | Optimistic Sync | Optimistic Sync WithPush | Server Push | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CheckInternet | — | ✅ | ❌ | ✅ | ✅️ | ✅️ |