createReactiveActionStore
Wraps an async function in a ReactiveActionStore. Each dispatch creates a fresh
AbortController and aborts the previous one; the superseded call's outcome is dropped,
so only the most recent dispatch can mutate state.
The wrapped function receives the AbortSignal as its first argument, followed by whatever
arguments were passed to dispatch. Callers attach their own cancellation source per-call via
ReactiveActionStore.withSignal — store.withSignal(signal).dispatch(...). The caller's
signal is composed with the per-dispatch controller via AbortSignal.any, so aborting it
cancels the in-flight call and surfaces the abort reason on state.
Type Parameters
| Type Parameter | Description |
|---|---|
TArgs extends readonly unknown[] | Argument tuple forwarded from dispatch to fn. |
TResult | Resolved value type of fn. |
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | (signal, ...args) => Promise<TResult> | Async function to wrap. Receives an AbortSignal plus the dispatch arguments. |
Returns
ReactiveActionStore<TArgs, TResult>
A ReactiveActionStore exposing dispatch, dispatchAsync, getState, subscribe,
reset, and withSignal.