-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@xstate/graph] Add toGraph() #1366
Conversation
🦋 Changeset is good to goLatest commit: 142f54e We got this. This PR includes changesets to release 1 package
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 |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 142f54e:
|
packages/xstate-graph/src/graph.ts
Outdated
} from './types'; | ||
import { getChildren } from 'xstate/lib/stateUtils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the exact purpose of @xstate/graph
? Seems like such an algorithm (getChildren
) would, maybe, be a good candidate to be included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - the purpose of @xstate/graph
is for graph-related utilities and helper functions, such as traversal, etc.
A good example of this is Cytoscape.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What not to like about this one? 😉 Great job!
Just please add an appropriate changeset so this will get added to the next release.
This PR introduces a helper function that converts machines to a directed graph structure, making it easy to use with graph-related algorithms, such as GraphViz and ELK.
See the snapshot for more details.