Releases: tivac/xstate-component-tree
v7.0.1
v6.1.1
v6.1.0
Minor Changes
-
#117
0cec0db
Thanks @tivac! - Add machine info to each resultOtherwise root components of parallel sibling child machines can end up not being actually comparable.
[ [Object: null prototype] { + machine: "(machine).child-one", path: false, component: [Function: child], props: false, children: [] }, [Object: null prototype] { + machine: "(machine).child-two", path: false, component: [Function: child], props: false, children: [] } ]
v6.0.2
Patch Changes
-
#115
51cfe5e
Thanks @tivac! - Fix an issue where in specific situations child trees would not be built.If a child machine has an
invoke
that immediately triggers a no-op event, theComponentTree
instance wouldn't actually walk that child machine for components to render. This was due to an interesting interaction between the xstate.changed
property and wheninvoke
s within the statechart are run.Now whenever the
ComponentTree
sees a new machine it hasn't walked is running, it will walk it.
v6.0.1
v6.0.0
Major Changes
-
#111
a0ec633
Thanks @tivac! - Add.d.ts
files to releases and restructure exports.Previously
import ComponentTree from "xstate-component-tree"; import componentHelper from "xstate-component-tree/component";
Now
import { ComponentTree, componentHelper } from "xstate-component-tree";
Minor Changes
-
#113
88d1dba
Thanks @tivac! - Component helper preserves.meta
fieldsPrevious using the helper like this:
helper(Component, { meta: { fooga: "wooga", }, });
would return an object with no
meta.fooga
property. Now those keys are properly preserved if they exist.meta.load
will still be overwritten if it exists, because it is required for the helper to function. A warning if it exists may be introduced in a future release.
v5.2.0
Minor Changes
-
#98
e7cd20d
Thanks @tivac! - Support for components at the root of machinescreateMachine({ initial: "foo", meta: { component: RootComponent, }, states: { foo: { meta: { component: FooComponent, }, }, }, });
Previously
RootComponent
would be ignored, now it will be the first component in the tree andFooComponent
will be placed as a child of it.
v5.1.0
Minor Changes
-
#74
951cea7
Thanks @tivac! - Adding.can()
API from XStateThe
.can()
API is a simple passthrough to the interpreter for the root statechart being managed byxstate-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.From the XState docs on
.can()
:Determines whether sending the event will cause a non-forbidden transition to be selected, even if the transitions have no actions nor change the state value.
v5.0.1
v5.0.0
Major Changes
-
#69
b6c9fc8
Thanks @tivac! - Always provide a valid initial value to subscribersPreviously if you called the
.subscribe()
method on aComponentTree
instance before the statechart had been processed the return value would befalse
. This meant that subscribers would have to add checks to do anything against the returned value, since they couldn't depend on the.matches
/.hasTag
/.broadcast
APIs existing.This change fixes that, and ensures that even if the statechart hasn't been walked yet the initial value stored has all the expected APIs, along with a reasonable value for the
tree
property of[]
. There isn't a great fallback value for.state
at this time though.