Skip to content

Releases: tivac/xstate-component-tree

v4.2.0

23 Jun 19:19
44775e0
Compare
Choose a tag to compare

Minor Changes

  • #67 a8aa4ac Thanks @tivac! - Added .send() API

    The .send() API is a simple passthrough to the interpreter for the root statechart being managed by xstate-component-tree, and is intended as a convenience function to make it easier to interact with a ComponentTree instance instead of a direct XState Interpreter reference.

    XState Docs on .send()

v4.1.1

22 Jun 23:11
b24ef25
Compare
Choose a tag to compare

Patch Changes

  • #65 1f93bbc Thanks @tivac! - Fix for handling the case where a child machine has already been destroyed but xstate-component-tree hasn't gotten that notice yet.

    Mostly comes up when you have { type : "final" } states in the child machine and an invoke.onDone transition in the parent.

v4.1.0

22 Jun 21:55
Compare
Choose a tag to compare

Minor Changes

  • #63 d9d3820 Thanks @tivac! - Added observable API

    Available on the ComponentTree instance as .subscribe(callback), calls the callback function immediately with the most recent result and then will re-call it each time a build completes.

    Follows the svelte store contract which isn't strictly compliant with any official observable APIs but is extremely simple and usable.

    The callback passed to .subscribe(...) will immediately be called with the most recent result of building the component tree (or false if it hasn't finished yet), and then for each complete tree building run after that the callback will be called with a single argument. The arg is an Object with a null prototype and the following properties:

    • tree, nested component structures. This is the same as the first argument to the older new ComponentTree(service, callback) API.
    • state, an XState State instance representing the most recent state of the root statechart.
    • matches(<state>), state.matches() but for every statechart instance including any invoked statecharts.
    • hasTag(<tag>), state.hasTag() but for every statechart instance including any invoked statecharts.
    • broadcast(<event>), service.send() but for every statechart instance including any invoked statecharts. Prefer using this instead of setting invoke.autoForward because it'll reduce the amount of junk events sent to invoked children.

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

v4.0.0

16 Mar 06:55
Compare
Choose a tag to compare

4.0.0 (2022-03-16)

⚠ BREAKING CHANGES

  • previously the second arg to the callback function had a single data property on it representing the last State object seen by the top-level machine. Now it has state (same as data was previously), and some bound APIs for interacting with the statechart: .hasTag(), .broadcast(), and .matches(). These are the same APIs available on the ComponentTree instance but made available through the callback args for convenience.

Features

v3.5.0

15 Mar 07:11
Compare
Choose a tag to compare

3.5.0 (2022-03-15)

Features

  • add .hasTag(), .matches(), and .broadcast() APIs (#41) (108ec3e)

Feature Explanations

  • .broadcast(), to send an event to all of the machines, allowing you to not use autoforward
  • .hasTag() calls the built-in xstate .hasTag() API against all the cached state objects (stopping at the first successful one)
  • .matches() calls the built-in xstate .matches() API against all the cached state objects (stopping at the first successful one)

NOTE: Not a breaking change because the public API didn't meaningfully shift, but the internals of xstate-component-tree have been significantly changed in this release. Instead of invoking a new ComponentTree class for every child machine it now tracks them all without any need for recursion or new class instances. Should be a bit lighter at run-time as a result.

v3.4.2

20 Feb 21:37
Compare
Choose a tag to compare

3.4.2 (2022-02-20)

Bug Fixes

  • Use ./components instead of /components for package.json subpath export. (#34) (99b0e68)

v3.4.1

24 Nov 22:00
Compare
Choose a tag to compare

3.4.1 (2021-11-24)

v3.4.0

24 Nov 22:01
Compare
Choose a tag to compare

3.4.0 (2021-11-24)

Features

  • Add component helper to xstate-component-tree package (#29) (6e28384)

v3.3.1

03 Oct 16:46
Compare
Choose a tag to compare

3.3.1 (2020-10-03)

Bug Fixes

  • clear dist when building (068f209)

v3.3.0

03 Oct 16:45
Compare
Choose a tag to compare

3.3.0 (2020-10-03)

Bug Fixes