Repository navigation
Version 0.15.0
Pre-release
Pre-release
Breaking Changes
- Equality check for objects and arrays switched from referential equality to deep equality with a new helper function
isEqual(). - Effects no longer support the matcher object syntax. Instead two new helper function
resolve()andmatch()do this job in a more composable way that can be used as well in computed callbacks.
New Features
Stores
- New signal primitive called
store()that takes plain objects (records) or arrays and create nestable data structures of independent signals. - Like any signal, stores have a
.get()method that unwraps its current value. - Like states, stores have
.set()and.update()methods to mutate the data structure as a whole. - Proxy access or mutate a branch of the data structure, where store (for records and arrays) or state (for primitives and all other objects) methods can be used.
- Stores have
.add()and.remove()methods to append or remove a single reactive property. - Stores dispatch
store-add,store-change, andstore-removecustom events whenever reactive properties are added, mutated or removed. - Like other signals of Cause & Effect, stores have a static type in TypeScript and each reactive property is non-nullable. Optional properties and arrays give you the flexibility to add and remove reactive properties or items.
Async Effects
- Like computed callbacks, effect callbacks can now be async too.
- Like async computed callbacks, async effect callbacks can now be cancelled via
AbortSignal. - As parametric polymorhism with AbortSignal as first parameter for async effect signals made type inference shaky and too complicated, we decided to factor out the signal resolution and suspense / error boundary matching into composable functions:
resolve()andmatch(). See breaking changes above. The new solution is more flexible and better tree-shakeable.
Tests
- Comprehensive tests for new store signals, async effects and new helper functions.
Documentation
- Updated README to document the usage of new store signals, async effects and helper functions.