Skip to content

Conversation

@tivac
Copy link
Owner

@tivac tivac commented Jun 28, 2022

Previously if you called the .subscribe() method on a ComponentTree instance before the statechart had been processed the return value would be false. 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.

@tivac tivac self-assigned this Jun 28, 2022
@changeset-bot
Copy link

changeset-bot bot commented Jun 28, 2022

🦋 Changeset detected

Latest commit: 32fdeb8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate-component-tree Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter
Copy link

Codecov Report

Merging #69 (32fdeb8) into main (44775e0) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #69   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          573       580    +7     
=========================================
+ Hits           573       580    +7     
Impacted Files Coverage Δ
src/component-tree.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44775e0...32fdeb8. Read the comment docs.

@tivac tivac merged commit b6c9fc8 into main Jun 28, 2022
@tivac tivac deleted the initial-state branch June 28, 2022 19:18
@github-actions github-actions bot mentioned this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants