Skip to content

Instantly share code, notes, and snippets.

@tmlangley
Created April 15, 2020 18:52
Show Gist options
  • Save tmlangley/b88d40288e2606566cad38d409c71978 to your computer and use it in GitHub Desktop.
Save tmlangley/b88d40288e2606566cad38d409c71978 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const FiltersMachine = Machine({
id: 'filters',
initial: 'loading',
context: {
results: [],
filterParams: []
},
states: {
loading: {
initial: 'fetchingAllFilterOptions',
states: {
fetchingAllFilterOptions: {
after: {
1500: '#filtersSuccess'
},
exit: sendParent('FILTERS_READY')
},
refiningFilters: {
after: {
1500: '#filtersSuccess',
},
exit: sendParent('FILTERS_READY')
}
},
},
success: {
id: 'filtersSuccess',
on: {
REFINE_FILTERS: 'loading.refiningFilters',
}
},
failure: {
on: {
RETRY: 'loading'
}
}
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment