Skip to content

Releases: soxtoby/event-reduce

v0.7.4

11 Feb 06:10

Choose a tag to compare

  • Fixed a bug where source derivations could trigger a derivation to update while it was already updating.

v0.7.3

31 Mar 03:41

Choose a tag to compare

  • Fixed typing for new-style derived decorator on boolean properties

v0.7.2

12 Nov 09:53

Choose a tag to compare

  • Fixes for legacy decorators.

v0.7.1

12 Nov 09:29

Choose a tag to compare

  • Support for new decorator syntax (in addition to legacy syntax).
    • @reduced on auto-accessor properties and getters.
    • @derived on getters.
    • @state on fields, auto-accessor properties, and getters.
    • @state('param') on classes, for marking constructor properties as state.
    • @model and @events on classes.
  • @model is required on class when new @reduced, @derived, or @state decorators are used.

v0.7.0

03 Sep 10:03

Choose a tag to compare

  • Improved performance and memory usage.
  • Disabled expensive validation in production.
  • Fixed rendering in React strict mode.
  • Derivation.unsubscribeFromSources no longer clears list of sources.
  • useModel, useDerived, and useReduced no longer dispose their value on "unmount".
  • Removed notifyObservers parameter from ObservableValue.setValue.
  • Support for @reduced decorator on getter properties.
  • Events returned from getters in @events classes are memoized.
  • Fixed disposing mutable models.

v0.6.0

04 Apr 08:36

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

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.