Skip to content

Instantly share code, notes, and snippets.

@ChristianMurphy
Created December 15, 2020 04:22
Show Gist options
  • Save ChristianMurphy/713ab0954f00977b19ab04842bae2bf7 to your computer and use it in GitHub Desktop.
Save ChristianMurphy/713ab0954f00977b19ab04842bae2bf7 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine(
{
id: "unified",
type: "parallel",
states: {
phase: {
initial: "new",
states: {
new: {
entry: ["addTag(phase/new)"],
on: {
status: {
target: "invalid",
cond: "closed",
},
},
},
open: {},
invalid: {
entry: ["removeTag(*)", "addTag(phase/invalid)"],
on: {
status: {
target: "no",
cond: "reopen",
},
},
},
no: {
entry: ["removeTag(*)", "addTag(phase/no)"],
},
},
},
template: {
initial: "missing",
states: {
missing: {
entry: ["comment(missing-template)"],
on: {
edit: [
{
target: "correct",
cond: "correct",
},
{
target: "incorrect",
cond: "incorrect",
},
],
},
},
correct: {
on: {
edit: [
{
target: "missing",
cond: "missing",
},
{
target: "incorrect",
cond: "incorrect",
},
],
},
},
incorrect: {
on: {
edit: [
{
target: "missing",
cond: "missing",
},
{
target: "correct",
cond: "correct",
},
],
},
},
},
},
},
},
{
guards: {
closed: () => true,
reopen: () => true,
correct: () => false,
incorrect: () => true,
missing: () => true,
},
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment