Last active
November 19, 2020 20:18
-
-
Save mindrones/972d49cd6a94ea17938e67390c8dd6af to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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", | |
"sendCurrentUrlUpdated" | |
] | |
}, | |
"CURRENT_URL_UPDATED": { | |
"target": "Idle", | |
"actions": "updateEntry" | |
} | |
} | |
} | |
} | |
}, | |
"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" | |
], | |
"always": [ | |
{ | |
"target": "Matching", | |
"cond": "isMatching" | |
}, | |
{ | |
"target": "Dirty" | |
} | |
] | |
}, | |
"Matching": { | |
"id": "Matching", | |
"entry": [ | |
"logEvent", | |
"sendResultsUpdated" | |
] | |
}, | |
"Dirty": { | |
"id": "Dirty", | |
"initial": "CheckingCache", | |
"entry": [ | |
"logEvent" | |
], | |
"states": { | |
"CheckingCache": { | |
"entry": [ | |
"logEvent", | |
"setCacheKey" | |
], | |
"always": [ | |
{ | |
"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": () => {} | |
}, | |
"sendCurrentUrlUpdated": { | |
"type": "xstate.send", | |
"event": { | |
"type": "CURRENT_URL_UPDATED" | |
}, | |
"id": "CURRENT_URL_UPDATED" | |
}, | |
"updateEntry": () => {}, | |
"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": () => {}, | |
"isMatching": () => {} | |
}, | |
"services": { | |
"apiRequest": () => {} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment