Skip to content

Instantly share code, notes, and snippets.

@dpraimeyuu
Last active May 10, 2021 10:30
Show Gist options
  • Save dpraimeyuu/79c95ab31d7a01568f54dd8704552034 to your computer and use it in GitHub Desktop.
Save dpraimeyuu/79c95ab31d7a01568f54dd8704552034 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: 'fetch',
initial: 'sync_idle',
context: {
retries: 0
},
states: {
sync_idle: {
on: {
sync_started: "fetching_groups"
}
},
fetching_groups: {
on: {
assignment_groups_fetched: "fetching_assignments"
}
},
fetching_assignments: {
on: {
assignments_fetched: "assigning_group_ownership"
}
},
assigning_group_ownership: {
on: {
no_related_assignments_found: "sending_assignments_when_no_group_sent",
mixed_contractors_found:
"sending_assignments_when_no_group_sent",
assignments_found_for_a_contractor: "sending_group"
}
},
sending_assignments_when_no_group_sent: {
on: {
no_group_found_in_azure: "sync_idle"
}
},
sending_assignments_when_no_group_sent: {
on: {
no_group_found_in_azure: "sync_idle"
}
},
sending_group: {
on: {
group_sent: "sending_assignments"
}
},
sending_assignments: {
on: {
successfully_sent: "sync_idle"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment