Releases: soxtoby/event-reduce
Releases · soxtoby/event-reduce
v0.6.0
- New derivation invalidation logic ensures that derivations always get the latest values from their sources.
IObservableValue<T>
once again implementsIObservable<T>
, andvalues
property has been removed.- Replaced
PromiseQueue
withMicrotaskQueue
. - Derivations take in an optional
valuesEqual
function to determine if the values have changed. - Added optional dependencies parameter to
useModel()
to allow the model to be recreated when the dependencies change. - Events and event classes will produce errors if used directly as state. They can still be part of models that are in state.
- Removed the deprecated
readonly
property on mutable models.
Logging improvements
- Improved logging performance.
- Improved logging for react components.
- Fixed a memory leak where all sources were being held onto by logs.
- All logs are collapsed by default.
- Built-in "restored" event is not logged as a source for reductions.
v0.5.0
IObservable
s are nowDisposable
. The[Symbol.dispose]
method cleans up both sources and observers.ObservableValue
s can have multiple "owners", and are disposed once removed from every owner.- Improved type definitions for
State<T>
andScoped<T, Scope>
. Subject
takes in agetDisplayName
parameter, similar to other observables.- Added
IObservable.filterMap()
, which allows selecting something from inside an event, and only passing it along if it was found. - Derivations log the source that invalidated them when they re-calculate.
useDerived
re-calculates every render unless external dependencies are specified and haven't changed.- Derived props in model proxies are now calculated correctly when a source prop has been overridden on the proxy.
- Better logging for React elements by
reactive
anduseReactive
. - Performance improvements for disposing models and serializing state.
Breaking changes
IEvent
andIAsyncEvent
return the value that was passed into them.- Derivations no longer re-calculate immediately when a dependency changes. Instead, they're invalidated, and re-calculated on next access.
IObservableValue<T>
now implementsIObservable<void>
and fires when the value is invalidated. To subscribe to changes of the actual value, use thevalues
property.- Removed
watch
andIWatcher
now that derivations can be subscribed to without the value being re-calculated. matchesScope
requires thatscope
is anobject
, similar toIEvent.scope
.Subject
no longer allows different "in" and "out" types.- Triggering an event in a derivation is now an error.
reactive
component props are no longer observable. Use theuseObservedProps
hook instead if neccessary.reactive
is now just a thin wrapper arounduseReactive
, and no longer appliesmemo
orforwardRef
to the component.