Skip to content

Instantly share code, notes, and snippets.

@kdgerona
Last active June 11, 2021 17:26
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 kdgerona/0f25bbc7c8fad227f8669e25682e633a to your computer and use it in GitHub Desktop.
Save kdgerona/0f25bbc7c8fad227f8669e25682e633a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const context = {
config: {},
data: {
entity_id: '',
entity: 'users',
selected_navigation: '',
navigations: [],
browse: [],
fullScreenedComponent: {
component_name: ''
}
}
}
const config = {
id: 'full-dialog-container',
initial: 'load_navigations',
context,
states: {
load_navigations: {
// Possible to query browse navigation as well.
entry: ['getDialogMenuItems'],
on: {
SUCCESS: {
target: 'ready'
},
FAILED: {
target: 'failed'
}
}
},
ready: {
invoke: [],
on: {
CLOSE:{
target: 'done',
},
SELECT_NAVIGATION: {
actions: ['assignSelectedNavigation']
},
ADD_CHILD_NAVIGATION: {
actions: [
'assignChildToNavigations',
'assignSelectedNavigation'
]
},
CLOSE_NAVIGATION: [
{
cond: 'isParentNavigation',
target: 'done'
},
{
actions: ['updateSelectedToPrevNavigation']
}
],
ZOOM_IN_COMPONENT: {
actions: ['assignFullScreenedComponent']
},
ZOOM_OUT_COMPONENT: {
actions: ['clearFullScreenedComponent']
}
}
},
done: {
type: 'final'
},
failed: {
entry: ['sendParentErrorMessage']
}
}
}
const implementations = {
actions: {}
}
const machine = Machine(config, implementations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment