Skip to content

Instantly share code, notes, and snippets.

@cogell
Last active November 8, 2019 22:06
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 cogell/9ba7c153d9b49b92fe455897958629e1 to your computer and use it in GitHub Desktop.
Save cogell/9ba7c153d9b49b92fe455897958629e1 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)
// /home
// /allow-location
// on yes -> start /results
// on no -> /invite to enter location
// /invite to enter location
// /loading
// /results
// /no-selection
// /valid-selection
// /empty
// /error
const fetchMachine = Machine({
id: 'choose-home-patch',
initial: 'allowLocation',
states: {
allowLocation: {
on: {
ALLOW_LOCATION: 'loading',
NO_LOCATION: 'enterLocation',
}
},
enterLocation: {
on: {
SUBMIT: 'loading',
}
},
loading: {
on: {
ERROR: 'error',
NO_RESULTS: 'noResults',
RESULTS: 'results',
SUBMIT: 'loading',
}
},
results: {
initial: 'noSelection',
states: {
noSelection: {
on: {
SELECT: 'selection',
}
},
selection: {
on: {
UN_SELECT: 'noSelection',
}
}}
},
noResults: {
on: {
SUBMIT: 'loading',
}
},
error: {
on: {
SUBMIT: 'loading'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment