Created
November 18, 2020 23:01
-
-
Save mindrones/7a144a4b8be8b3b9cf77ac3531f0f01a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
"id": "ExploreRoute", | |
"initial": "Interactive", | |
"on": {}, | |
"states": { | |
"Interactive": { | |
"entry": [ | |
"logEvent" | |
], | |
"type": "parallel", | |
"states": { | |
"History": { | |
"id": "History", | |
"initial": "Idle", | |
"states": { | |
"Idle": { | |
"entry": [ | |
"logEvent" | |
], | |
"on": { | |
"RESULTS_UPDATED": { | |
"target": "Idle", | |
"actions": "updateCurrentURL" | |
} | |
} | |
} | |
} | |
}, | |
"Selecting": { | |
"initial": "Idle", | |
"states": { | |
"Idle": { | |
"entry": [ | |
"logEvent" | |
], | |
"on": { | |
"SELECTED_FIELDS": { | |
"target": "Idle", | |
"actions": [ | |
"selectFields", | |
"updateQuery", | |
"sendQueryUpdated" | |
] | |
}, | |
"TOGGLED_FIELD_COUNTER": { | |
"target": "Idle", | |
"actions": [ | |
"toggleField", | |
"updateQuery", | |
"sendQueryUpdated" | |
] | |
}, | |
"SELECTED_NEXT_FIELD": { | |
"target": "Idle", | |
"actions": [ | |
"selectNextField", | |
"updateQuery", | |
"sendQueryUpdated" | |
] | |
}, | |
"SELECTED_PREVIOUS_FIELD": { | |
"target": "Idle", | |
"actions": [ | |
"selectPreviousField", | |
"updateQuery", | |
"sendQueryUpdated" | |
] | |
} | |
} | |
} | |
} | |
}, | |
"Results": { | |
"id": "Results", | |
"initial": "CheckMatching", | |
"on": { | |
"QUERY_UPDATED": { | |
"target": "#Results.CheckMatching" | |
} | |
}, | |
"states": { | |
"CheckMatching": { | |
"entry": [ | |
"logEvent" | |
], | |
"on": { | |
"": [ | |
{ | |
"target": "Matching", | |
"cond": "isMatching" | |
}, | |
{ | |
"target": "Dirty" | |
} | |
] | |
} | |
}, | |
"Matching": { | |
"id": "Matching", | |
"entry": [ | |
"logEvent", | |
"sendResultsUpdated" | |
] | |
}, | |
"Dirty": { | |
"id": "Dirty", | |
"initial": "CheckingCache", | |
"entry": [ | |
"logEvent" | |
], | |
"states": { | |
"CheckingCache": { | |
"entry": [ | |
"logEvent", | |
"setCacheKey" | |
], | |
"on": { | |
"": [ | |
{ | |
"target": "#Matching", | |
"cond": "isInCache", | |
"actions": "loadFromCache" | |
}, | |
{ | |
"target": "Pending" | |
} | |
] | |
} | |
}, | |
"Pending": { | |
"entry": [ | |
"logEvent" | |
], | |
"invoke": { | |
"id": "request", | |
"src": "apiRequest", | |
"onDone": { | |
"target": "#Results.Matching", | |
"actions": [ | |
"updateCache", | |
"updateCurrentResults" | |
] | |
}, | |
"onError": { | |
"target": "Error" | |
} | |
} | |
}, | |
"Error": { | |
"id": "Error", | |
"entry": [ | |
"logEvent", | |
"getError" | |
] | |
} | |
} | |
} | |
} | |
} | |
}, | |
"on": { | |
"DATASET_UPDATED": { | |
"target": "#ExploreRoute.Interactive", | |
"actions": [ | |
"selectDataset" | |
] | |
} | |
} | |
} | |
} | |
}, { | |
"actions": { | |
"updateCurrentURL": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"getError": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"loadFromCache": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"sendResultsUpdated": { | |
"type": "xstate.send", | |
"event": { | |
"type": "RESULTS_UPDATED" | |
}, | |
"id": "RESULTS_UPDATED" | |
}, | |
"setCacheKey": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"updateCache": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"updateCurrentResults": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"logEvent": { | |
"type": "xstate.log", | |
"label": "logEvent", | |
"expr": () => {} | |
}, | |
"selectDataset": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"selectFields": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"selectNextField": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"selectPreviousField": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"sendQueryUpdated": { | |
"type": "xstate.send", | |
"event": { | |
"type": "QUERY_UPDATED" | |
}, | |
"id": "QUERY_UPDATED" | |
}, | |
"toggleField": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
}, | |
"updateQuery": { | |
"type": "xstate.assign", | |
"assignment": () => {} | |
} | |
}, | |
"guards": { | |
"isInCache": () => {}, | |
"isNotInCache": () => {}, | |
"isMatching": () => {}, | |
"isNotMatching": () => {} | |
}, | |
"services": { | |
"apiRequest": () => {} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment