Skip to content

Instantly share code, notes, and snippets.

@ascorbic
Last active July 7, 2020 15:00
Show Gist options
  • Save ascorbic/732c17badfd7fa22bc5552d66f432a85 to your computer and use it in GitHub Desktop.
Save ascorbic/732c17badfd7fa22bc5552d66f432a85 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({
"id": "build",
"initial": "initializing",
"states": {
"initializing": {
"invoke": {
"src": "initialize",
"onDone": {
"target": "initializingDataLayer",
"actions": ["assignStoreAndWorkerPool", "spawnMutationListener"]
}
}
},
"initializingDataLayer": {
"on": {
"ADD_NODE_MUTATION": { "actions": ["markNodesDirty", "callApi"] }
},
"invoke": {
"src": "initializeDataLayer",
"onDone": {
"actions": ["assignServiceResult", "clearWebhookBody"],
"target": "finishingBootstrap"
}
}
},
"finishingBootstrap": {
"on": {
"ADD_NODE_MUTATION": { "actions": ["markNodesDirty", "callApi"] }
},
"invoke": { "onDone": { "target": "runningQueries" } }
},
"runningQueries": {
"on": {
"QUERY_FILE_CHANGED": {
"actions": { "to": "run-queries", "type": "xstate.send", "id": "" , "event": {"type": "QUERY_FILE_CHANGED"}}
}
},
"invoke": {
"id": "run-queries",
"src": "runQueries",
"onDone": { "target": "doingEverythingElse" }
}
},
"doingEverythingElse": {
"invoke": {
"onDone": [
{ "target": "startingDevServers" },
{ "target": "waiting" }
]
}
},
"startingDevServers": {
"invoke": {
"src": "startWebpackServer",
"onDone": { "target": "waiting", "actions": "assignServers" }
}
},
"waiting": {
"on": {
"ADD_NODE_MUTATION": {
"actions": { "to": "waiting", "type": "xstate.send", "id": "" , "event": {"type": "ADD_NODE_MUTATION"}}
},
"QUERY_FILE_CHANGED": {
"actions": { "to": "waiting", "type": "xstate.send", "id": "" , "event":{"type": "QUERY_FILE_CHANGED"}}
},
"EXTRACT_QUERIES_NOW": { "target": "runningQueries" }
},
"invoke": {
"id": "waiting",
"src": "waitForMutations",
"onDone": {
"actions": "assignServiceResult",
"target": "rebuildingPages"
}
}
},
"rebuildingPages": {
"invoke": {
"src": "initializeDataLayer",
"onDone": {
"actions": "assignServiceResult",
"target": "runningQueries"
}
}
}
},
"on": {
"ADD_NODE_MUTATION": { "actions": "addNodeMutation" },
"QUERY_FILE_CHANGED": { "actions": "markQueryFilesDirty" },
"WEBHOOK_RECEIVED": {
"target": "initializingDataLayer",
"actions": "assignWebhookBody"
}
}
},
{
"actions": {
"markNodesDirty": {
"type": "xstate.assign",
"assignment": { "nodesMutatedDuringQueryRun": true }
},
"addNodeMutation": { "type": "xstate.assign", "assignment": {} },
"spawnMutationListener": { "type": "xstate.assign", "assignment": {} },
"assignStoreAndWorkerPool": { "type": "xstate.assign" },
"assignServiceResult": { "type": "xstate.assign" },
"assignServers": { "type": "xstate.assign" },
"markQueryFilesDirty": {
"type": "xstate.assign",
"assignment": { "queryFilesDirty": true }
},
"assignWebhookBody": { "type": "xstate.assign", "assignment": {} },
"clearWebhookBody": { "type": "xstate.assign", "assignment": {} }
},
"guards": {},
"services": {
"initializeDataLayer": {
"id": "(machine)",
"key": "(machine)",
"context": {},
"type": "compound",
"initial": "start",
"history": false,
"states": {
"start": {
"id": "(machine).start",
"key": "start",
"type": "atomic",
"history": false,
"states": {},
"on": {
"": [
{
"target": ["#(machine).buildingSchema"],
"cond": { "type": "xstate.guard", "name": "cond" },
"event": "",
"actions": [],
"source": "#(machine).start",
"internal": false,
"eventType": ""
},
{
"target": ["#(machine).customizingSchema"],
"event": "",
"actions": [],
"source": "#(machine).start",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"target": ["#(machine).buildingSchema"],
"cond": { "type": "xstate.guard", "name": "cond" },
"event": "",
"actions": [],
"source": "#(machine).start",
"internal": false,
"eventType": ""
},
{
"target": ["#(machine).customizingSchema"],
"event": "",
"actions": [],
"source": "#(machine).start",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [],
"order": 1,
"invoke": []
},
"customizingSchema": {
"id": "(machine).customizingSchema",
"key": "customizingSchema",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.customizing-schema": [
{
"target": ["#(machine).sourcingNodes"],
"event": "done.invoke.customizing-schema",
"actions": [],
"source": "#(machine).customizingSchema",
"internal": false,
"eventType": "done.invoke.customizing-schema"
}
]
},
"transitions": [
{
"target": ["#(machine).sourcingNodes"],
"event": "done.invoke.customizing-schema",
"actions": [],
"source": "#(machine).customizingSchema",
"internal": false,
"eventType": "done.invoke.customizing-schema"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "customizing-schema",
"src": "customizeSchema",
"onDone": { "target": "sourcingNodes" },
"type": "xstate.invoke"
}
],
"order": 2,
"invoke": [
{
"src": "customizeSchema",
"id": "customizing-schema",
"onDone": { "target": "sourcingNodes" },
"type": "xstate.invoke"
}
]
},
"sourcingNodes": {
"id": "(machine).sourcingNodes",
"key": "sourcingNodes",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.sourcing-nodes": [
{
"target": ["#(machine).buildingSchema"],
"actions": [{ "type": "assignChangedPages" }],
"event": "done.invoke.sourcing-nodes",
"source": "#(machine).sourcingNodes",
"internal": false,
"eventType": "done.invoke.sourcing-nodes"
}
]
},
"transitions": [
{
"target": ["#(machine).buildingSchema"],
"actions": [{ "type": "assignChangedPages" }],
"event": "done.invoke.sourcing-nodes",
"source": "#(machine).sourcingNodes",
"internal": false,
"eventType": "done.invoke.sourcing-nodes"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "sourcing-nodes",
"src": "sourceNodes",
"onDone": {
"target": "buildingSchema",
"actions": "assignChangedPages"
},
"type": "xstate.invoke"
}
],
"order": 3,
"invoke": [
{
"src": "sourceNodes",
"id": "sourcing-nodes",
"onDone": {
"target": "buildingSchema",
"actions": "assignChangedPages"
},
"type": "xstate.invoke"
}
]
},
"buildingSchema": {
"id": "(machine).buildingSchema",
"key": "buildingSchema",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.building-schema": [
{
"target": ["#(machine).creatingPages"],
"actions": [{ "type": "assignGraphQLRunners" }],
"event": "done.invoke.building-schema",
"source": "#(machine).buildingSchema",
"internal": false,
"eventType": "done.invoke.building-schema"
}
]
},
"transitions": [
{
"target": ["#(machine).creatingPages"],
"actions": [{ "type": "assignGraphQLRunners" }],
"event": "done.invoke.building-schema",
"source": "#(machine).buildingSchema",
"internal": false,
"eventType": "done.invoke.building-schema"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "building-schema",
"src": "buildSchema",
"onDone": {
"target": "creatingPages",
"actions": "assignGraphQLRunners"
},
"type": "xstate.invoke"
}
],
"order": 4,
"invoke": [
{
"id": "building-schema",
"src": "buildSchema",
"onDone": {
"target": "creatingPages",
"actions": "assignGraphQLRunners"
},
"type": "xstate.invoke"
}
]
},
"creatingPages": {
"id": "(machine).creatingPages",
"key": "creatingPages",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.creating-pages": [
{
"target": ["#(machine).creatingPagesStatefully"],
"actions": [{ "type": "assignChangedPages" }],
"cond": { "type": "xstate.guard", "name": "cond" },
"event": "done.invoke.creating-pages",
"source": "#(machine).creatingPages",
"internal": false,
"eventType": "done.invoke.creating-pages"
},
{
"target": ["#(machine).done"],
"actions": [{ "type": "assignChangedPages" }],
"event": "done.invoke.creating-pages",
"source": "#(machine).creatingPages",
"internal": false,
"eventType": "done.invoke.creating-pages"
}
],
"ADD_NODE_MUTATION": [
{
"actions": [
{ "type": "markNodesDirty" },
{ "type": "callApi" }
],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).creatingPages",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
}
]
},
"transitions": [
{
"target": ["#(machine).creatingPagesStatefully"],
"actions": [{ "type": "assignChangedPages" }],
"cond": { "type": "xstate.guard", "name": "cond" },
"event": "done.invoke.creating-pages",
"source": "#(machine).creatingPages",
"internal": false,
"eventType": "done.invoke.creating-pages"
},
{
"target": ["#(machine).done"],
"actions": [{ "type": "assignChangedPages" }],
"event": "done.invoke.creating-pages",
"source": "#(machine).creatingPages",
"internal": false,
"eventType": "done.invoke.creating-pages"
},
{
"actions": [
{ "type": "markNodesDirty" },
{ "type": "callApi" }
],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).creatingPages",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "creating-pages",
"src": "createPages",
"onDone": [
{
"target": "creatingPagesStatefully",
"actions": "assignChangedPages"
},
{ "target": "done", "actions": "assignChangedPages" }
],
"type": "xstate.invoke"
}
],
"order": 5,
"invoke": [
{
"id": "creating-pages",
"src": "createPages",
"onDone": [
{
"target": "creatingPagesStatefully",
"actions": "assignChangedPages"
},
{ "target": "done", "actions": "assignChangedPages" }
],
"type": "xstate.invoke"
}
]
},
"creatingPagesStatefully": {
"id": "(machine).creatingPagesStatefully",
"key": "creatingPagesStatefully",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.creating-pages-statefully": [
{
"target": ["#(machine).done"],
"event": "done.invoke.creating-pages-statefully",
"actions": [],
"source": "#(machine).creatingPagesStatefully",
"internal": false,
"eventType": "done.invoke.creating-pages-statefully"
}
]
},
"transitions": [
{
"target": ["#(machine).done"],
"event": "done.invoke.creating-pages-statefully",
"actions": [],
"source": "#(machine).creatingPagesStatefully",
"internal": false,
"eventType": "done.invoke.creating-pages-statefully"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "creating-pages-statefully",
"src": "createPagesStatefully",
"onDone": { "target": "done" },
"type": "xstate.invoke"
}
],
"order": 6,
"invoke": [
{
"src": "createPagesStatefully",
"id": "creating-pages-statefully",
"onDone": { "target": "done" },
"type": "xstate.invoke"
}
]
},
"done": {
"id": "(machine).done",
"key": "done",
"type": "final",
"history": false,
"states": {},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": 7,
"invoke": []
}
},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": -1,
"invoke": []
},
"runQueries": {
"id": "(machine)",
"key": "(machine)",
"context": {},
"type": "compound",
"initial": "extractingQueries",
"history": false,
"states": {
"extractingQueries": {
"id": "extracting-queries",
"key": "extractingQueries",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.extracting-queries": [
{
"target": ["#(machine).writingRequires"],
"event": "done.invoke.extracting-queries",
"actions": [],
"source": "#extracting-queries",
"internal": false,
"eventType": "done.invoke.extracting-queries"
}
]
},
"transitions": [
{
"target": ["#(machine).writingRequires"],
"event": "done.invoke.extracting-queries",
"actions": [],
"source": "#extracting-queries",
"internal": false,
"eventType": "done.invoke.extracting-queries"
}
],
"entry": [{ "type": "markFilesClean" }],
"exit": [],
"activities": [
{
"id": "extracting-queries",
"src": "extractQueries",
"onDone": { "target": "writingRequires" },
"type": "xstate.invoke"
}
],
"order": 1,
"invoke": [
{
"id": "extracting-queries",
"src": "extractQueries",
"onDone": { "target": "writingRequires" },
"type": "xstate.invoke"
}
]
},
"writingRequires": {
"id": "(machine).writingRequires",
"key": "writingRequires",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.writing-requires": [
{
"target": ["#(machine).calculatingDirtyQueries"],
"event": "done.invoke.writing-requires",
"actions": [],
"source": "#(machine).writingRequires",
"internal": false,
"eventType": "done.invoke.writing-requires"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).writingRequires",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"target": ["#(machine).calculatingDirtyQueries"],
"event": "done.invoke.writing-requires",
"actions": [],
"source": "#(machine).writingRequires",
"internal": false,
"eventType": "done.invoke.writing-requires"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).writingRequires",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "writing-requires",
"src": "writeOutRequires",
"onDone": { "target": "calculatingDirtyQueries" },
"type": "xstate.invoke"
}
],
"order": 2,
"invoke": [
{
"src": "writeOutRequires",
"id": "writing-requires",
"onDone": { "target": "calculatingDirtyQueries" },
"type": "xstate.invoke"
}
]
},
"calculatingDirtyQueries": {
"id": "(machine).calculatingDirtyQueries",
"key": "calculatingDirtyQueries",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.calculating-dirty-queries": [
{
"target": ["#(machine).runningStaticQueries"],
"actions": [{ "type": "assignDirtyQueries" }],
"event": "done.invoke.calculating-dirty-queries",
"source": "#(machine).calculatingDirtyQueries",
"internal": false,
"eventType": "done.invoke.calculating-dirty-queries"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).calculatingDirtyQueries",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"target": ["#(machine).runningStaticQueries"],
"actions": [{ "type": "assignDirtyQueries" }],
"event": "done.invoke.calculating-dirty-queries",
"source": "#(machine).calculatingDirtyQueries",
"internal": false,
"eventType": "done.invoke.calculating-dirty-queries"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).calculatingDirtyQueries",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "calculating-dirty-queries",
"src": "calculateDirtyQueries",
"onDone": {
"target": "runningStaticQueries",
"actions": "assignDirtyQueries"
},
"type": "xstate.invoke"
}
],
"order": 3,
"invoke": [
{
"id": "calculating-dirty-queries",
"src": "calculateDirtyQueries",
"onDone": {
"target": "runningStaticQueries",
"actions": "assignDirtyQueries"
},
"type": "xstate.invoke"
}
]
},
"runningStaticQueries": {
"id": "(machine).runningStaticQueries",
"key": "runningStaticQueries",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.running-static-queries": [
{
"target": ["#(machine).runningPageQueries"],
"event": "done.invoke.running-static-queries",
"actions": [],
"source": "#(machine).runningStaticQueries",
"internal": false,
"eventType": "done.invoke.running-static-queries"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).runningStaticQueries",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"target": ["#(machine).runningPageQueries"],
"event": "done.invoke.running-static-queries",
"actions": [],
"source": "#(machine).runningStaticQueries",
"internal": false,
"eventType": "done.invoke.running-static-queries"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).runningStaticQueries",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "running-static-queries",
"src": "runStaticQueries",
"onDone": { "target": "runningPageQueries" },
"type": "xstate.invoke"
}
],
"order": 4,
"invoke": [
{
"src": "runStaticQueries",
"id": "running-static-queries",
"onDone": { "target": "runningPageQueries" },
"type": "xstate.invoke"
}
]
},
"runningPageQueries": {
"id": "(machine).runningPageQueries",
"key": "runningPageQueries",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.running-page-queries": [
{
"target": ["#(machine).waitingForJobs"],
"actions": [{ "type": "flushPageData" }],
"event": "done.invoke.running-page-queries",
"source": "#(machine).runningPageQueries",
"internal": false,
"eventType": "done.invoke.running-page-queries"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).runningPageQueries",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"target": ["#(machine).waitingForJobs"],
"actions": [{ "type": "flushPageData" }],
"event": "done.invoke.running-page-queries",
"source": "#(machine).runningPageQueries",
"internal": false,
"eventType": "done.invoke.running-page-queries"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#extracting-queries"],
"event": "",
"actions": [],
"source": "#(machine).runningPageQueries",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "running-page-queries",
"src": "runPageQueries",
"onDone": {
"target": "waitingForJobs",
"actions": "flushPageData"
},
"type": "xstate.invoke"
}
],
"order": 5,
"invoke": [
{
"src": "runPageQueries",
"id": "running-page-queries",
"onDone": {
"target": "waitingForJobs",
"actions": "flushPageData"
},
"type": "xstate.invoke"
}
]
},
"waitingForJobs": {
"id": "(machine).waitingForJobs",
"key": "waitingForJobs",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.waiting-for-jobs": [
{
"target": ["#(machine).done"],
"event": "done.invoke.waiting-for-jobs",
"actions": [],
"source": "#(machine).waitingForJobs",
"internal": false,
"eventType": "done.invoke.waiting-for-jobs"
}
]
},
"transitions": [
{
"target": ["#(machine).done"],
"event": "done.invoke.waiting-for-jobs",
"actions": [],
"source": "#(machine).waitingForJobs",
"internal": false,
"eventType": "done.invoke.waiting-for-jobs"
}
],
"entry": [],
"exit": [],
"activities": [
{
"id": "waiting-for-jobs",
"src": "waitUntilAllJobsComplete",
"onDone": { "target": "done" },
"type": "xstate.invoke"
}
],
"order": 6,
"invoke": [
{
"src": "waitUntilAllJobsComplete",
"id": "waiting-for-jobs",
"onDone": { "target": "done" },
"type": "xstate.invoke"
}
]
},
"done": {
"id": "(machine).done",
"key": "done",
"type": "final",
"history": false,
"states": {},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": 7,
"invoke": []
}
},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": -1,
"invoke": []
},
"waitForMutations": {
"id": "(machine)",
"key": "(machine)",
"context": { "nodeMutationBatch": [], "runningBatch": [] },
"type": "compound",
"initial": "idle",
"history": false,
"states": {
"idle": {
"id": "(machine).idle",
"key": "idle",
"type": "atomic",
"history": false,
"states": {},
"on": {
"ADD_NODE_MUTATION": [
{
"actions": [{ "type": "addNodeMutation" }],
"target": ["#(machine).batchingNodeMutations"],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).idle",
"internal": false,
"eventType": "ADD_NODE_MUTATION"
}
],
"QUERY_FILE_CHANGED": [
{
"actions": [{ "type": "extractQueries" }],
"event": "QUERY_FILE_CHANGED",
"source": "#(machine).idle",
"internal": true,
"eventType": "QUERY_FILE_CHANGED"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).batchingNodeMutations"],
"event": "",
"actions": [],
"source": "#(machine).idle",
"internal": false,
"eventType": ""
}
]
},
"transitions": [
{
"actions": [{ "type": "addNodeMutation" }],
"target": ["#(machine).batchingNodeMutations"],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).idle",
"internal": false,
"eventType": "ADD_NODE_MUTATION"
},
{
"actions": [{ "type": "extractQueries" }],
"event": "QUERY_FILE_CHANGED",
"source": "#(machine).idle",
"internal": true,
"eventType": "QUERY_FILE_CHANGED"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).batchingNodeMutations"],
"event": "",
"actions": [],
"source": "#(machine).idle",
"internal": false,
"eventType": ""
}
],
"entry": [],
"exit": [],
"activities": [],
"order": 1,
"invoke": []
},
"batchingNodeMutations": {
"id": "(machine).batchingNodeMutations",
"key": "batchingNodeMutations",
"type": "atomic",
"history": false,
"states": {},
"on": {
"ADD_NODE_MUTATION": [
{
"actions": [{ "type": "addNodeMutation" }],
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).committingBatch"],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": "ADD_NODE_MUTATION"
},
{
"actions": [{ "type": "addNodeMutation" }],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).batchingNodeMutations",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
}
],
"": [
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).committingBatch"],
"event": "",
"actions": [],
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": ""
}
],
"xstate.after(1000)#(machine).batchingNodeMutations": [
{
"target": ["#(machine).committingBatch"],
"event": "xstate.after(1000)#(machine).batchingNodeMutations",
"delay": 1000,
"actions": [],
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": "xstate.after(1000)#(machine).batchingNodeMutations"
}
]
},
"transitions": [
{
"actions": [{ "type": "addNodeMutation" }],
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).committingBatch"],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": "ADD_NODE_MUTATION"
},
{
"actions": [{ "type": "addNodeMutation" }],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).batchingNodeMutations",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
},
{
"cond": { "type": "xstate.guard", "name": "cond" },
"target": ["#(machine).committingBatch"],
"event": "",
"actions": [],
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": ""
},
{
"target": ["#(machine).committingBatch"],
"event": "xstate.after(1000)#(machine).batchingNodeMutations",
"delay": 1000,
"actions": [],
"source": "#(machine).batchingNodeMutations",
"internal": false,
"eventType": "xstate.after(1000)#(machine).batchingNodeMutations"
}
],
"entry": [
{
"type": "xstate.send",
"event": {
"type": "xstate.after(1000)#(machine).batchingNodeMutations"
},
"delay": 1000,
"id": "xstate.after(1000)#(machine).batchingNodeMutations"
}
],
"exit": [
{
"type": "xstate.cancel",
"sendId": "xstate.after(1000)#(machine).batchingNodeMutations"
}
],
"activities": [],
"order": 2,
"invoke": []
},
"committingBatch": {
"id": "(machine).committingBatch",
"key": "committingBatch",
"type": "atomic",
"history": false,
"states": {},
"on": {
"done.invoke.runMutationBatch": [
{
"actions": [
{
"type": "xstate.assign",
"assignment": { "runningBatch": [] }
}
],
"target": ["#(machine).rebuild"],
"event": "done.invoke.runMutationBatch",
"source": "#(machine).committingBatch",
"internal": false,
"eventType": "done.invoke.runMutationBatch"
}
],
"ADD_NODE_MUTATION": [
{
"actions": [{ "type": "addNodeMutation" }],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).committingBatch",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
}
]
},
"transitions": [
{
"actions": [
{
"type": "xstate.assign",
"assignment": { "runningBatch": [] }
}
],
"target": ["#(machine).rebuild"],
"event": "done.invoke.runMutationBatch",
"source": "#(machine).committingBatch",
"internal": false,
"eventType": "done.invoke.runMutationBatch"
},
{
"actions": [{ "type": "addNodeMutation" }],
"event": "ADD_NODE_MUTATION",
"source": "#(machine).committingBatch",
"internal": true,
"eventType": "ADD_NODE_MUTATION"
}
],
"entry": [{ "type": "xstate.assign" }],
"exit": [],
"activities": [
{
"id": "runMutationBatch",
"src": "runMutationBatch",
"onDone": {
"actions": {
"type": "xstate.assign",
"assignment": { "runningBatch": [] }
},
"target": "rebuild"
},
"type": "xstate.invoke"
}
],
"order": 3,
"invoke": [
{
"src": "runMutationBatch",
"onDone": {
"actions": {
"type": "xstate.assign",
"assignment": { "runningBatch": [] }
},
"target": "rebuild"
},
"type": "xstate.invoke",
"id": "runMutationBatch"
}
]
},
"rebuild": {
"id": "(machine).rebuild",
"key": "rebuild",
"type": "final",
"history": false,
"states": {},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": 4,
"invoke": []
}
},
"on": {},
"transitions": [],
"entry": [],
"exit": [],
"activities": [],
"order": -1,
"invoke": []
}
},
"activities": {},
"delays": {}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment