Skip to content

Instantly share code, notes, and snippets.

@ascorbic
Created July 7, 2020 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ascorbic/4733369b14cce570758adb2c766bc915 to your computer and use it in GitHub Desktop.
Save ascorbic/4733369b14cce570758adb2c766bc915 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
"initial": "start",
"context": {},
"states": {
start: {
on:{"": [
{
target: "buildingSchema",
cond: ({ skipSourcing }) =>
!!skipSourcing,
},
{
target: "customizingSchema",
},
]},
},
"customizingSchema": {
"invoke": {
"src": "customizeSchema",
"id": "customizing-schema",
"onDone": { "target": "sourcingNodes" }
}
},
"sourcingNodes": {
"invoke": {
"src": "sourceNodes",
"id": "sourcing-nodes",
"onDone": {
"target": "buildingSchema",
"actions": "assignChangedPages"
}
}
},
"buildingSchema": {
"invoke": {
"id": "building-schema",
"src": "buildSchema",
"onDone": {
"target": "creatingPages",
"actions": "assignGraphQLRunners"
}
}
},
"creatingPages": {
"on": {
"ADD_NODE_MUTATION": { "actions": ["markNodesDirty", "callApi"] }
},
"invoke": {
"id": "creating-pages",
"src": "createPages",
"onDone": [
{
"target": "creatingPagesStatefully",
"actions": "assignChangedPages"
},
{ "target": "done", "actions": "assignChangedPages" }
]
}
},
"creatingPagesStatefully": {
"invoke": {
"src": "createPagesStatefully",
"id": "creating-pages-statefully",
"onDone": { "target": "done" }
}
},
"done": { "type": "final" }
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment