Skip to content

Instantly share code, notes, and snippets.

@DaveWelling
Created June 15, 2020 14:25
Show Gist options
  • Save DaveWelling/17324612943e753b75e9a9312fe9f0e7 to your computer and use it in GitHub Desktop.
Save DaveWelling/17324612943e753b75e9a9312fe9f0e7 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
/* eslint camelcase: 0 */
// Ignore camelcase in this file.
const config = {
id: 'loadFsm',
initial: 'is_init',
states: {
is_init: {
entry: ['do_addSubscriptions', 'do_createDefaultFilters'],
on: {
'': 'is_loading'
}
},
is_ready: {
on: {
FILTER_CHANGE: {
target: 'is_loading',
actions: 'do_updateFilters'
},
SHUTDOWN: 'is_destroyed'
}
},
is_loading: {
entry: 'do_load',
on: {
LOAD_SUCCESS: {
target: 'is_ready',
actions: 'do_sendSuccessToParent'
},
LOAD_FAILURE: 'is_loadFailure',
SHUTDOWN: 'is_destroyed'
}
},
is_loadFailure: {
on: {
RETRY_LOAD: {
target: 'is_loading'
},
SHUTDOWN: 'is_destroyed'
}
},
is_destroyed: {
final: true
}
}
}; // To see in https://xstate.js.org/viz/ , uncomment this next line and copy it and
// everything above it into the 'code' section of that page.
const loadMachine = Machine(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment