Skip to content

Instantly share code, notes, and snippets.

@jkusachi
Last active July 4, 2021 16:45
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 jkusachi/5b6be08f6ea82c039352fb54c7ee1007 to your computer and use it in GitHub Desktop.
Save jkusachi/5b6be08f6ea82c039352fb54c7ee1007 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: 'lineItemCatalog',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
INIT: 'loadingCatalog'
}
},
loadingCatalog: {
on: {
RESOLVE: 'catalogReady',
REJECT: 'errorLoadingCatalog'
}
},
errorLoadingCatalog: {
on: {
RETRY: 'loadingCatalog'
}
},
catalogReady: {
on: {
SET_LINE_ITEM: 'loadingLineItems'
}
},
loadingLineItems: {
on: {
RESOLVE: 'ready',
REJECT: 'errorLoadingLineItems',
}
},
errorLoadingLineItems: {
on: {
RETRY: 'loadingLineItems'
}
},
ready: {
on: {
CHANGE_LINE_ITEM: 'loadingLineItems',
SUBMIT: 'submitting'
}
},
submitting: {
on: {
RESOLVE: 'success',
REJECT: 'error'
}
},
error: {
},
success: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment