Skip to content

Instantly share code, notes, and snippets.

@Andarist
Created August 8, 2020 22:29
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 Andarist/1e8443a7033018d2b489cf2a83c6787b to your computer and use it in GitHub Desktop.
Save Andarist/1e8443a7033018d2b489cf2a83c6787b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
initial: 'fetching_user',
states: {
fetching_user: {
invoke: {
src: 'fetchUser',
onDone: [{
cond: 'hasUser',
target: 'fetching_resources'
}, {
target: 'idle'
}],
onError: 'failed'
}
},
fetching_resources: {
type: 'parallel',
states: {
fetching_projects: {
initial: 'fetching',
states: {
fetching: {
invoke: {
src: 'fetchProjects',
onDone: 'done',
onError: '#failed'
}
},
done: {
type: 'final'
}
}
},
fetching_metrics: {
initial: 'fetching',
states: {
fetching: {
invoke: {
src: 'fetchMetrics',
onDone: 'done',
onError: '#failed'
}
},
done: {
type: 'final'
}
}
},
fetching_profiles: {
initial: 'fetching',
states: {
fetching: {
invoke: {
src: 'fetchProfiles',
onDone: 'done',
onError: '#failed'
}
},
done: {
type: 'final'
}
}
},
fetching_sources: {
initial: 'fetching',
states: {
fetching: {
invoke: {
src: 'fetchSources',
onDone: 'done',
onError: '#failed'
}
},
done: {
type: 'final'
}
}
}
},
onDone: 'success'
},
idle: {
type: 'final'
},
success: {
type: 'final',
onEntry: 'initSuccess'
},
failed: {
id: 'failed',
type: 'final',
onEntry: 'initFail'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment