Skip to content

Releases: soxtoby/event-reduce

v0.6.0

04 Apr 08:36
Compare
Choose a tag to compare
  • New derivation invalidation logic ensures that derivations always get the latest values from their sources.
  • IObservableValue<T> once again implements IObservable<T>, and values property has been removed.
  • Replaced PromiseQueue with MicrotaskQueue.
  • 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

15 Jul 00:16
Compare
Choose a tag to compare
  • IObservables are now Disposable. The [Symbol.dispose] method cleans up both sources and observers.
  • ObservableValues can have multiple "owners", and are disposed once removed from every owner.
  • Improved type definitions for State<T> and Scoped<T, Scope>.
  • Subject takes in a getDisplayName 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 and useReactive.
  • Performance improvements for disposing models and serializing state.

Breaking changes

  • IEvent and IAsyncEvent 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 implements IObservable<void> and fires when the value is invalidated. To subscribe to changes of the actual value, use the values property.
  • Removed watch and IWatcher now that derivations can be subscribed to without the value being re-calculated.
  • matchesScope requires that scope is an object, similar to IEvent.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 the useObservedProps hook instead if neccessary.
  • reactive is now just a thin wrapper around useReactive, and no longer applies memo or forwardRef to the component.