Skip to content

Instantly share code, notes, and snippets.

@joshpitzalis
Last active January 29, 2020 08:51
Show Gist options
  • Save joshpitzalis/a5477c28a1c4626b457111af3cfabcfd to your computer and use it in GitHub Desktop.
Save joshpitzalis/a5477c28a1c4626b457111af3cfabcfd to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'contacts',
initial: 'add_contacts_button',
states: {
add_contacts_button: {
on: {
ADDED: 'permission_screen'
}
},
permission_screen: {
on: {
APPROVED: 'selection_screen',
REJECTED: 'add_contacts_button'
}
},
selection_screen: {
onEntry: 'deselectConflicts',
on: {
CONTACT_SELECTED: 'selection_screen',
CONTACT_DESELECTED: 'selection_screen',
SELECT_ALL: 'selection_screen',
DESELECT_ALL: 'selection_screen',
ADD_CONTACTS: 'add_contacts_button',
},
initial: 'entireSelection',
states: {
entireSelection: {
TOGGLE_FILTER: 'justTheConflicts'
},
justTheConflicts: {
on: {
SELECTED_FIELD_TO_OVERWRITE:'justTheConflicts',
SELECTED_FIELD_FOR_ALL_OVERWRITES:'justTheConflicts',
TOGGLE_FILTER: 'entireSelection'
}
},
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment