Skip to content

Instantly share code, notes, and snippets.

@DVG
Last active September 6, 2022 18:01
Show Gist options
  • Save DVG/6edd8b1b2cdef4672330d43b1fee99f9 to your computer and use it in GitHub Desktop.
Save DVG/6edd8b1b2cdef4672330d43b1fee99f9 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: 'fetch',
initial: 'order_lookup',
context: {
returnId: 1,
some_loop_data: {}
},
states: {
order_lookup: {
on: {
SEARCH: 'select_order'
}
},
select_order: {
on: {
SELECT: 'select_items',
CANCEL: 'order_lookup'
}
},
select_items: {
on: {
SELECT_ITEM: 'set_parent_reason',
FINALIZE: 'finalize',
CANCEL: 'order_lookup'
}
},
set_parent_reason: {
on: {
NEXT: 'set_child_reason',
CANCEL: 'select_items'
}
},
set_child_reason: {
on: {
NEXT: 'select_items',
CANCEL: 'select_items'
}
},
finalize: {
on: {
CANCEL: 'order_lookup',
SUBMIT: 'order_lookup'
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment