3.2.0
Coaction 3.2.0
Coaction 3.2.0 makes capability-based worker fallback explicit and predictable, fixes async client type inference across first-party framework integrations, and adds a reproducible cross-tab SharedWorker example.
All official Coaction packages are versioned together at 3.2.0.
Highlights
Contract-safe local fallback
An explicit worker: undefined or clientTransport: undefined now selects a strict local authority while preserving the async client contract:
const worker =
typeof SharedWorker === 'undefined'
? undefined
: new SharedWorker(new URL('./store.js', import.meta.url), {
type: 'module'
});
const store = create(source, { worker });
await store.getState().save();On this fallback path:
- getState() actions remain promise-based.
- Action effects become observable after the promise job runs.
- Initial state, action arguments, results, and low-level state mutations must remain JSON-compatible.
- Each tab owns independent local state; the fallback is not a SharedWorker client mirror.
- Worker construction and transport setup failures are still surfaced rather than silently changing the authority model.
Calls without client transport options continue to create ordinary synchronous local stores.
Correct async types across framework integrations
Angular, React, Solid, Svelte, and Vue creators now preserve async client action types when worker or clientTransport is supplied through variables or object spreads.
Zero-option and plain local calls remain synchronous, while getInitialState() on async stores retains the original synchronous initialization shape.
This type correction may expose call sites that previously treated client actions as synchronous. Those calls should now be awaited.
Cross-tab todos example
A new browser example demonstrates:
- one SharedWorker authority shared by multiple tabs;
- explicit local fallback when SharedWorker is unavailable;
- synchronized creation, completion, filtering, editing, and deletion;
- preservation of an in-progress edit while another tab updates the store.
The scenario is covered end to end on Chromium, Firefox, and WebKit.
Clearer adoption boundaries
The documentation now includes an English and Chinese "When not to use Coaction" guide covering:
- plain single-tab state;
- non-JSON domain models;
- call sites that cannot await actions;
- ecosystem and browser-support tradeoffs;
- situations where workers, cross-tab authority, or reactive derivation justify Coaction.
Worker fallback and reconnect documentation has also been expanded to distinguish independent local fallback from a real client mirror.
Upgrade notes
Update coaction and any framework integration together:
npm install coaction@3.2.0 @coaction/react@3.2.0Replace @coaction/react with the integration packages used by your application.
If your application previously passed worker: undefined or clientTransport: undefined:
- Await actions before reading their effects.
- Keep state, action arguments, results, setState(), and apply() updates JSON-compatible.
- Treat missing SharedWorker support as an error when independent per-tab state is not acceptable.
History compatibility
@coaction/history continues to depend on travels@^2.1.0. Compatibility is verified against the published Travels 2.1.0 and 2.2.0 releases. Travels 3 is not part of this release.
Full Changelog: v3.1.0...v3.2.0