Skip to content

Instantly share code, notes, and snippets.

@sukima
Created October 7, 2020 18:49
Show Gist options
  • Save sukima/11e6b1acec2e730d4167c5ac43f0f562 to your computer and use it in GitHub Desktop.
Save sukima/11e6b1acec2e730d4167c5ac43f0f562 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: 'wizard',
initial: 'details',
context: {},
states: {
cancelled: {
type: 'final',
entry: 'closeModal',
},
details: {
initial: 'invalid',
on: {
PREV: 'cancelled',
},
states: {
invalid: {
id: 'invalid',
on: {
VALID: 'valid',
SERVER_VALIDATING: 'validating.remain',
},
},
valid: {
id: 'valid',
on: {
INVALID: 'invalid',
SERVER_VALIDATING: 'validating.remain',
NEXT: 'validating.next',
},
},
validating: {
states: {
remain: {
on: {
SERVER_VALID: '#valid',
SERVER_INVALID: '#invalid',
NEXT: 'next',
},
},
next: {
on: {
SERVER_VALID: '#affectedSummary',
SERVER_INVALID: '#invalid',
},
},
},
},
},
},
affectedSummary: {
id: 'affectedSummary',
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment