Skip to content

2.1.0

Choose a tag to compare

@unadlib unadlib released this 09 Jul 17:28
· 219 commits to main since this release

Coaction 2.0.0

Coaction 2.1.0 is a hardening release for the 2.x runtime. It tightens fixed-schema behavior, root replacement semantics, unsafe patch handling, and mutable adapter synchronization across MobX, Pinia, and Valtio.

Highlights

  • Hardened fixed-schema runtime invariants for public state modules and replacement-style updates.
  • Rejected destroyed-store operations across core and mutable adapter paths.
  • Standardized root add/remove/replace semantics through shared helper flows used by history, persist, Yjs, and mutable adapters.
  • Rejected unsafe patch-hook output before applying patches, avoiding partial commits from mixed safe/unsafe patch sets.
  • Prevented public state facades from resurrecting omitted known root keys during patch application.

Core Runtime

  • Public state modules are locked so unknown keys cannot be added to the public module.
  • store.apply() now uses raw state as the patch base when a public state facade is passed, preserving omitted known root keys.
  • Root replacement helpers now provide consistent patch semantics for middleware and integrations.
  • Integration helper exports and external mutable-runtime unknown-key boundaries are documented.

Mutable Adapters

MobX, Pinia, and Valtio now handle root removal and re-addition more consistently:

  • store.apply() defaults to store.getPureState() as the patch base.
  • Mutable patch application uses raw snapshots when the public state facade is passed.
  • Removed known root keys stay removed after later ordinary patches.
  • Re-added known root keys restore raw accessor descriptors, keeping external mutable state, Coaction raw state, and public state linked.
  • Unknown root properties written directly to the external runtime are documented as not being promoted into Coaction state.

Middleware and Sync

@coaction/history

  • Local undo/redo root replacements now run through the shared patch pipeline.
  • Middleware patch transforms and logger before/after state stay consistent during time travel.
  • history({ limit }) now validates that limit is a non-negative integer.

@coaction/persist

  • Version mismatches without a migration now skip hydration instead of silently merging stale persisted schemas.
  • Shared-main hydration uses root replacement patches, so exact custom merges can safely remove known root keys.

@coaction/yjs

  • Remote root replacements and delete operations use the shared root replacement patch flow.
  • Schema errors from remote state are recoverable and restore authoritative Yjs state instead of diverging Coaction raw/public state.

Framework Bindings

@coaction/vue

  • Vue state proxy mutation traps now reject direct set, delete, defineProperty, and prototype writes instead of silently writing to the proxy target.

Pinia

  • @coaction/pinia no longer sets Pinia's global active instance from adapt().
  • The adapter now uses a private/default Pinia instance unless callers provide their own.

Package Versions

All official packages are version-aligned at 2.1.0.

Adapters and framework packages now require:

"coaction": ">=2.1.0 <3"

Upgrade coaction and any @coaction/* packages together to avoid mixing 2.1 adapters with a 2.0 core runtime.

Verification

This release passed:

  • formatting
  • lint
  • typecheck
  • package quality checks
  • package size checks
  • full test suite and e2e checks

Full Changelog: v2.0.0...v2.1.0