Last active
February 6, 2020 14:51
-
-
Save felippenardi/3e1146a94f365e23a9d4b5d2f9ed6a8c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const editingMachine = Machine({ | |
id: 'editing', | |
initial: 'editing', | |
states: { | |
editing: { | |
id: 'live', | |
on: { | |
SAVE_CHANGES: 'saving', | |
DISCARD_CHANGES: 'confirmingDiscard' | |
} | |
}, | |
confirmingDiscard: { | |
on: { | |
CONFIRM_DISCARD: { | |
actions: 'discard' | |
}, | |
CANCEL_DISCARD: '#editing' | |
} | |
}, | |
saving: { | |
on: { | |
ON_SUCCESS: 'finish', | |
ON_CONFLICT: 'solvingConflict', | |
ON_FAILURE: 'editing' | |
} | |
}, | |
solvingConflict: { | |
on: { | |
OVERRIDE: 'finish', | |
CANCEL: 'editing' | |
} | |
}, | |
finish: { | |
id: 'finish', | |
type: 'final' | |
} | |
} | |
}, { | |
actions: { | |
discard: sendParent('DISCARD') | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment