Skip to content

Instantly share code, notes, and snippets.

@cogell
Created July 2, 2020 15:22
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 cogell/3d8e6a359adff3f99682f57964cf30ef to your computer and use it in GitHub Desktop.
Save cogell/3d8e6a359adff3f99682f57964cf30ef to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'app cold start',
initial: 'startUpScreen',
context: {
communities: [],
alerts: [],
},
states: {
startUpScreen: {
on: {
DATABASE_LOADED: 'startUpScreen2'
}
},
startUpScreen2: {
on: {
'': [
{target: 'homeFeed', cond: 'isOnboarded'},
{target: 'newUserOnboarding', cond: 'isMigrationNotNeeded'},
{target: 'migratedSuccessOnboarding', cond: 'isMigrationSuccess'},
{target: 'migratedFailureOnboarding', cond: 'isMigrationFailed'},
{target: 'notMigrated'}
]
}
},
homeFeed: {},
newUserOnboarding: {
on: {
FINISH_ONBOARDING: 'homeFeed',
}
},
migratedSuccessOnboarding: {
on: {
FINISH_ONBOARDING: 'homeFeed',
}
},
migratedFailureOnboarding: {
on: {
FINISH_ONBOARDING: 'homeFeed',
}
},
notMigrated: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment