asyncredux-nonreentrant-mixin
Add the NonReentrant mixin to prevent an action from dispatching while already in progress. Covers preventing duplicate form submissions, avoiding race conditions, and protecting long-running operations.
Best use case
asyncredux-nonreentrant-mixin is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Add the NonReentrant mixin to prevent an action from dispatching while already in progress. Covers preventing duplicate form submissions, avoiding race conditions, and protecting long-running operations.
Teams using asyncredux-nonreentrant-mixin should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/asyncredux-nonreentrant-mixin/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How asyncredux-nonreentrant-mixin Compares
| Feature / Agent | asyncredux-nonreentrant-mixin | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Add the NonReentrant mixin to prevent an action from dispatching while already in progress. Covers preventing duplicate form submissions, avoiding race conditions, and protecting long-running operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# NonReentrant Mixin
The `NonReentrant` mixin prevents concurrent execution of the same action type. When an action instance is already running, new dispatches of that same action are silently aborted.
## Basic Usage
Add the `NonReentrant` mixin to any action that should not run concurrently:
```dart
class SaveAction extends AppAction with NonReentrant {
Future<AppState?> reduce() async {
await http.put('http://myapi.com/save', body: 'data');
return null;
}
}
```
With this mixin:
- If the user clicks "Save" multiple times rapidly, only the first dispatch executes
- Subsequent dispatches while the first is running are silently aborted
- No duplicate API calls or race conditions occur
## How It Works
The `NonReentrant` mixin overrides the `abortDispatch` method. When `abortDispatch()` returns `true`, the action's `before()`, `reduce()`, and `after()` methods will not run, and the state stays unchanged.
By default, checks are based on the action's runtime type - multiple instances of the same action class cannot run simultaneously.
## Common Use Cases
1. **Preventing duplicate form submissions** - Stop users from accidentally submitting forms multiple times
2. **Protecting API calls** - Ensure save/update/delete operations don't fire concurrently
3. **Resource-intensive tasks** - Prevent expensive computations from running in parallel
4. **Avoiding race conditions** - Ensure sequential execution of operations that must not overlap
## Customization
### Allow Different Parameters to Run Concurrently
Override `nonReentrantKeyParams()` to allow actions with different parameters to run in parallel:
```dart
class SaveItemAction extends AppAction with NonReentrant {
final String itemId;
SaveItemAction(this.itemId);
@override
Object? nonReentrantKeyParams() => itemId;
Future<AppState?> reduce() async {
await saveItem(itemId);
return null;
}
}
```
With this customization:
- `SaveItemAction('A')` and `SaveItemAction('B')` can run concurrently
- Two `SaveItemAction('A')` dispatches will still block each other
### Share Keys Across Different Action Types
Override `computeNonReentrantKey()` to make different action classes block each other:
```dart
class SaveUserAction extends AppAction with NonReentrant {
final String orderId;
SaveUserAction(this.orderId);
@override
Object? computeNonReentrantKey() => orderId;
Future<AppState?> reduce() async { ... }
}
class DeleteUserAction extends AppAction with NonReentrant {
final String orderId;
DeleteUserAction(this.orderId);
@override
Object? computeNonReentrantKey() => orderId;
Future<AppState?> reduce() async { ... }
}
```
This prevents `SaveUserAction('123')` and `DeleteUserAction('123')` from running simultaneously - useful when different operations on the same resource must not overlap.
## Combining with Other Mixins
You can combine `NonReentrant` with other compatible mixins:
```dart
class LoadDataAction extends AppAction with CheckInternet, NonReentrant {
Future<AppState?> reduce() async {
final data = await fetchData();
return state.copy(data: data);
}
}
```
**Incompatible mixins:** `NonReentrant` cannot be combined with:
- `Throttle`
- `UnlimitedRetryCheckInternet`
- Most optimistic update mixins (check the compatibility matrix)
## References
URLs from the documentation:
- https://asyncredux.com/sitemap.xml
- https://asyncredux.com/flutter/advanced-actions/control-mixins
- https://asyncredux.com/flutter/advanced-actions/action-mixins
- https://asyncredux.com/flutter/advanced-actions/aborting-the-dispatch
- https://asyncredux.com/flutter/basics/dispatching-actions
- https://asyncredux.com/flutter/basics/async-actionsRelated Skills
asyncredux-undo-redo
Implement undo/redo functionality using state observers. Covers recording state history with stateObserver, creating a RecoverStateAction, implementing undo for the full state or partial state, and managing history limits.
asyncredux-observers
Set up observers for debugging and monitoring. Covers implementing actionObservers for dispatch logging, stateObserver for state change tracking, combining observers with globalWrapError, and using observers for analytics.
asyncredux-async-actions
Creates AsyncRedux (Flutter) asynchronous actions for API calls, database operations, and other async work.
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
mcp-create-declarative-agent
Skill converted from mcp-create-declarative-agent.prompt.md
MCP Architecture Expert
Design and implement Model Context Protocol servers for standardized AI-to-data integration with resources, tools, prompts, and security best practices
mathem-shopping
Automatiserar att logga in på Mathem.se, söka och lägga till varor från en lista eller recept, hantera ersättningar enligt policy och reservera leveranstid, men lämnar varukorgen redo för manuell checkout.
math-modeling
本技能应在用户要求"数学建模"、"建模比赛"、"数模论文"、"数学建模竞赛"、"建模分析"、"建模求解"或提及数学建模相关任务时使用。适用于全国大学生数学建模竞赛(CUMCM)、美国大学生数学建模竞赛(MCM/ICM)等各类数学建模比赛。
matchms
Mass spectrometry analysis. Process mzML/MGF/MSP, spectral similarity (cosine, modified cosine), metadata harmonization, compound ID, for metabolomics and MS data processing.
managing-traefik
Manages Traefik reverse proxy for local development. Use when routing domains to local services, configuring CORS, checking service health, or debugging connectivity issues.
managing-skills
Install, find, update, and manage agent skills. Use when the user wants to add a new skill, search for skills that do something, check if skills are up to date, or update existing skills. Triggers on: install skill, add skill, get skill, find skill, search skill, update skill, check skills, list skills.
manage-agents
Create, modify, and manage Claude Code subagents with specialized expertise. Use when you need to "work with agents", "create an agent", "modify an agent", "set up a specialist", "I need an agent for [task]", or "agent to handle [domain]". Covers agent file format, YAML frontmatter, system prompts, tool restrictions, MCP integration, model selection, and testing.